How can I show/hide a block on specific taxonomy URLs depending on term depth?
There is another way to answer your question, without PHP in the block settings: you can use the Rules block visibility module for this. Here is a quote from its project page:


  The Rules block visibility module allows Rules components to be used to control block visibility. This provides Drupal administrators and developers extreme flexibility in controlling when blocks should be displayed on their websites, in addition to the default visibility options provided by Drupal.
  
  The general idea is that if you can do it with Rules, you can use it to control block visibility, so the possibilities are limitless.
  
  Need to show a block only for users registered more than a month ago?
  
  Perhaps you have a block that must be shown only between 8am-5pm on weekdays?
  
  What about displaying or hiding a block based on current weather conditions?
  
  All of this can be done by using Rules block visibility.


With that, and as per the "if you can do it with Rules, you can use it to control block visibility" above, you've reduced your question to making Rules "check the path of the current page" (so that the appropriate menu block is shown on the appropriate pages).

For an illustration of how to use this module, refer to my answer to "How to show blocks by url, when nodes have multiple paths?". It includes some Rules Components (in Rules export format), which you should replace by the your variations to make it match your specific question.

So with 2 (similar) rules, 1 for each of both blocks, you should be able to get this to work.

To actually "determine the path structure in rules" (as in your extra comment below this answer), you might want to use a Rules Condition using a regular expression. Similar to the Rules Condition in the rule I included in my answer to "How to automatically skip intermediate redirects?".

Using regular expressions opens up many more situations (on top of the Rules block visibility module) where this solution can work. If you're not familiar with Regular Expressions (not obvious ...), then maybe you also want to look at my answer to "How to suppress a core Drupal warning or error message set with drupal_set_message for site users?".

Bonus:

This approach does NOT require the PHP filter to be enabled either (which you should try to avoid whenever possible) ...