The new user_menu added in
MDL-45893 shows a link to "My badges" even when badges are disabled at the site level.
Summary of the devchat discussion and comments below:
user_menu items must respect site settings and user capabilities. The most reliable way to do it is to use items from navigation and check if they are present for the current user. This will require changing syntax of the setting $CFG->customusermenuitems