diff --git a/core/lib/Drupal/Core/Routing/RouteBuilder.php b/core/lib/Drupal/Core/Routing/RouteBuilder.php
index e201b42..970b716 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilder.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilder.php
@@ -112,6 +112,21 @@ public function __construct(MatcherDumperInterface $dumper, LockBackendInterface
   }
 
   /**
+   * Checks that there is really no rebuild needed.
+   *
+   * @see https://drupal.org/node/356399
+   */
+  protected function checkRebuildNeeded() {
+    // To absolutely ensure that the router rebuild is required, re-load the
+    // variables in case they were set by another process.
+    $this->state->resetCache();
+    if ($this->state->get(static::REBUILD_NEEDED)) {
+      return TRUE;
+    }
+    return FALSE;
+  }
+
+  /**
    * {@inheritdoc}
    */
   public function rebuild() {
@@ -124,6 +139,11 @@ public function rebuild() {
       // We choose to block here since otherwise the routes might not be
       // available, resulting in a 404.
       $this->lock->wait('router_rebuild');
+
+      if ($this->checkRebuildNeeded()) {
+        $this->rebuild();
+      }
+
       return FALSE;
     }
 
