diff --git a/core/lib/Drupal/Core/Routing/RouteBuilder.php b/core/lib/Drupal/Core/Routing/RouteBuilder.php
index 5bea0a5..a57d057 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilder.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilder.php
@@ -105,6 +105,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() {
@@ -117,6 +132,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;
     }
 
@@ -176,6 +196,7 @@ public function rebuild() {
     $this->dumper->dump();
 
     $this->state->delete(static::REBUILD_NEEDED);
+
     $this->lock->release('router_rebuild');
     $this->dispatcher->dispatch(RoutingEvents::FINISHED, new Event());
     $this->building = FALSE;
