Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0.0-beta8
Description: 

#2451665: Don't rebuild the route on ModuleInstaller::install() (30% installer speedup) introduced to not rebuild the router before hook_install() is called, so in case code in hook_install() relies on new routes, it has to trigger the rebuild manually:

\Drupal::service('router.builder')->rebuild();
// Now the newly added route is available.
$route = \Drupal::service('router.route_provider')->getRouteByName('new_module.page');
// ... do something with the new route.

Note that a route rebuild will be triggered automatically at the end of the page request if a module is installed. Do not invoke router rebuilds unless you need to get route information in hook_intstall().

Impacts: 
Module developers