hook_menu_links_discovered_alter() not being called
Generally, alter hooks are invoked even if they are implemented in themes, but to be sure you always need to check the code invoking the specific alter hook.
In this case, hook_menu_links_discovered_alter() is invoked from MenuLinkManager::getDefinitions. You can see this by clicking on 1 invocation of hook_menu_links_discovered_alter().


  


That method only invokes the hook implemented by modules, as it uses the following code to invoke it.

  $this-&gt;moduleHandler-&gt;alter('menu_links_discovered', $definitions);


To allow themes to alter those links, the code should contain a line similar to the following one, where $this-&gt;themeManager is an object implementing the ThemeManagerInterface interface.

  $this-&gt;themeManager-&gt;alter('menu_links_discovered', $definitions);


In short, you can only implement hook_menu_links_discovered_alter() in a module.