There are two separate issues being discussed but they're heavily related.
Firstly, the items in the menu are cached - including the consequences of calling a hook. Which means on caching level 2, weird things can happen where plugin menu items won't necessarily be displayed (or worse, they'll continue to be displayed even when deactivated)
Secondly, determining the active menu item is potentially inaccurate because of the above.
I'm sort of wondering what the point of caching it is, though. It's very straightforward as it stands, and in fact the caching can screw things up given the gallery unread count.
Perhaps it would simply be better not to cache it at all.
Firstly, the items in the menu are cached - including the consequences of calling a hook. Which means on caching level 2, weird things can happen where plugin menu items won't necessarily be displayed (or worse, they'll continue to be displayed even when deactivated)
Secondly, determining the active menu item is potentially inaccurate because of the above.
I'm sort of wondering what the point of caching it is, though. It's very straightforward as it stands, and in fact the caching can screw things up given the gallery unread count.
Perhaps it would simply be better not to cache it at all.