diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php
index 3dfe65e..ad61e3c 100644
--- a/core/lib/Drupal/Core/Routing/RouteProvider.php
+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -180,6 +180,7 @@ public function getRoutesByNames($names, $parameters = array()) {
 
     $routes_to_load = array_diff($names, array_keys($this->routes));
 
+    $this->routeBuilder->rebuildIfNeeded();
     if ($routes_to_load) {
       $result = $this->connection->query('SELECT name, route FROM {' . $this->connection->escapeTable($this->tableName) . '} WHERE name IN (:names)', array(':names' => $routes_to_load));
       $routes = $result->fetchAllKeyed();
