How to determine the depth of a term in a custom taxonomy?

You can use wp_dropdown_categories():

Display or retrieve the HTML dropdown list of categories.

$args = array(
    'show_count'   => 1,
    'hierarchical' => 1,
    'taxonomy'     => 'my_taxonomy',
);

wp_dropdown_categories( $args );