diff --git a/core/lib/Drupal/Core/Routing/RouteBuilder.php b/core/lib/Drupal/Core/Routing/RouteBuilder.php
index a4b17e2..9ffb7bd 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilder.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilder.php
@@ -121,9 +121,28 @@ 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->routeBuilderIndicator->resetCache();
+    if ($this->routeBuilderIndicator->isRebuildNeeded()) {
+      return TRUE;
+    }
+    return FALSE;
+  }
+
+  /**
    * {@inheritdoc}
    */
   public function rebuild() {
+    if (!$this->checkRebuildNeeded()) {
+      return FALSE;
+    }
+
     if ($this->building) {
       throw new \RuntimeException('Recursive router rebuild detected.');
     }
@@ -133,6 +152,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;
     }
 
diff --git a/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php b/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php
index 5f06120..5cff225 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php
@@ -34,6 +34,13 @@ public function __construct(StateInterface $state) {
   /**
    * {@inheritdoc}
    */
+  public function resetCache() {
+    $this->state->resetCache();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function setRebuildNeeded() {
     $this->state->set(static::REBUILD_NEEDED, TRUE);
   }
diff --git a/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php b/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php
index 68ce5b8..3178174 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php
@@ -15,6 +15,11 @@
   const REBUILD_NEEDED = 'router_rebuild_needed';
 
   /**
+   * Reset the router cache.
+   */
+  public function resetCache();
+
+  /**
    * Sets the router to be rebuilt next time the kernel is terminated.
    *
    * @see \Drupal\Core\EventSubscriber\RouterRebuildSubscriber::onKernelTerminate()
