Filter By Category Dropdown List With Custom Taxonomies

Just from skimming your code, it actually pretty much does the same as the WordPress API function wp_dropdown_categories(). It isn’t as sophisticated though, no insult intended. Because wp_dropdown_categories() is capable of displaying deeper leveled hierarchies – correctly – then your own function, I can’t see a reason for not just using wp_dropdown_categories() for your purpose. If there is a reason, that I have overlooked or just can’t see, then you should take a look at the source of wp_dropdown_categories() to get some inspiration and/or guidance from it.