Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

In Drupal 7, indicating that the menu route needed to rebuilt was done via a variable:

variable_set('menu_rebuild_needed', TRUE);

Earlier in D8, the variable was moved to state:

\Drupal::state()->set('menu_rebuild_needed', TRUE);

Now this is done on the route builder:

\Drupal::service('router.builder')->setRebuildNeeded();

In earlier version of Drupal 8 route rebuilding was done explicit

\Drupal::service('router.builder')->rebuild();

as this costs a lot of computing power you can now mark the router to be rebuilt later (which will be done at the end of the request with the Kernel terminate event):

\Drupal::service('router.builder')->setRebuildNeeded();

Additional the RouteBuilder got an interface:
Drupal\Core\Routing\RouteBuilderInterface

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done