diff --git a/core/includes/common.inc b/core/includes/common.inc
index 91aa485..b776937 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -1295,8 +1295,10 @@ function drupal_flush_all_caches() {
   // Reset all static caches.
   drupal_static_reset();
 
-  // Wipe the PHP Storage caches.
-  PhpStorageFactory::get('service_container')->deleteAll();
+  // Invalidate the container.
+  \Drupal::service('kernel')->invalidateContainer();
+
+  // Wipe the PHP Storage cache.
   PhpStorageFactory::get('twig')->deleteAll();
 
   // Rebuild module and theme data.
diff --git a/core/includes/utility.inc b/core/includes/utility.inc
index ff65dc8..4ac4bb8 100644
--- a/core/includes/utility.inc
+++ b/core/includes/utility.inc
@@ -29,13 +29,17 @@ function drupal_rebuild(ClassLoader $class_loader, Request $request) {
   restore_error_handler();
   restore_exception_handler();
 
-  // Force kernel to rebuild container.
-  PhpStorageFactory::get('service_container')->deleteAll();
+  // Force kernel to rebuild php cache.
   PhpStorageFactory::get('twig')->deleteAll();
 
   // Bootstrap up to where caches exist and clear them.
   $kernel = new DrupalKernel('prod', $class_loader);
   $kernel->setSitePath(DrupalKernel::findSitePath($request));
+
+  // Rebuild the container on boot().
+  $kernel->boot(TRUE);
+
+  // Prepare a NULL request.
   $kernel->prepareLegacyRequest($request);
 
   foreach (Cache::getBins() as $bin) {
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 5457935..8f74e63 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -357,7 +357,7 @@ public function getAppRoot() {
   /**
    * {@inheritdoc}
    */
-  public function boot() {
+  public function boot($rebuild = FALSE) {
     if ($this->booted) {
       return $this;
     }
@@ -389,7 +389,7 @@ public function boot() {
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
 
     // Initialize the container.
-    $this->initializeContainer();
+    $this->initializeContainer($rebuild);
 
     // Ensure mt_rand() is reseeded to prevent random values from one page load
     // being exploited to predict random values in subsequent page loads.
@@ -998,9 +998,7 @@ protected function persistServices(ContainerInterface $container, array $persist
   }
 
   /**
-   * Force a container rebuild.
-   *
-   * @return \Symfony\Component\DependencyInjection\ContainerInterface
+   * {@inheritdoc}
    */
   public function rebuildContainer() {
     // Empty module properties and for them to be reloaded from scratch.
@@ -1010,6 +1008,14 @@ public function rebuildContainer() {
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function invalidateContainer() {
+    // Wipe the PHP Storage caches.
+    $this->storage()->deleteAll();
+  }
+
+  /**
    * Attach synthetic values on to kernel.
    *
    * @param ContainerInterface $container
diff --git a/core/lib/Drupal/Core/DrupalKernelInterface.php b/core/lib/Drupal/Core/DrupalKernelInterface.php
index b17ed80..739b48c 100644
--- a/core/lib/Drupal/Core/DrupalKernelInterface.php
+++ b/core/lib/Drupal/Core/DrupalKernelInterface.php
@@ -21,9 +21,12 @@
   /**
    * Boots the current kernel.
    *
+   * @param bool $rebuild
+   *   (optional) Whether to rebuild the container or not.
+   *
    * @return $this
    */
-  public function boot();
+  public function boot($rebuild = FALSE);
 
   /**
    * Shuts down the kernel.
@@ -97,6 +100,18 @@ public function getAppRoot();
   public function updateModules(array $module_list, array $module_filenames = array());
 
   /**
+   * Force a container rebuild.
+   *
+   * @return \Symfony\Component\DependencyInjection\ContainerInterface
+   */
+  public function rebuildContainer();
+
+  /**
+   * Invalidate the service container for the next request.
+   */
+  public function invalidateContainer();
+
+  /**
    * Prepare the kernel for handling a request without handling the request.
    *
    * @param \Symfony\Component\HttpFoundation\Request $request
diff --git a/core/lib/Drupal/Core/Test/TestRunnerKernel.php b/core/lib/Drupal/Core/Test/TestRunnerKernel.php
index f19afb3..8c35baa 100644
--- a/core/lib/Drupal/Core/Test/TestRunnerKernel.php
+++ b/core/lib/Drupal/Core/Test/TestRunnerKernel.php
@@ -50,7 +50,7 @@ public function __construct($environment, $class_loader) {
   /**
    * {@inheritdoc}
    */
-  public function boot() {
+  public function boot($rebuild = FALSE) {
     // Ensure that required Settings exist.
     if (!Settings::getAll()) {
       new Settings(array(
@@ -70,7 +70,7 @@ public function boot() {
     // In addition, ensure that PHP errors are not hidden away in logs.
     ini_set('display_errors', TRUE);
 
-    parent::boot();
+    parent::boot($rebuild);
 
     $this->getContainer()->get('module_handler')->loadAll();
 
diff --git a/core/modules/language/src/ConfigurableLanguageManager.php b/core/modules/language/src/ConfigurableLanguageManager.php
index a4ca11b..d4dad5c 100644
--- a/core/modules/language/src/ConfigurableLanguageManager.php
+++ b/core/modules/language/src/ConfigurableLanguageManager.php
@@ -8,7 +8,6 @@
 namespace Drupal\language;
 
 use Drupal\Core\Language\LanguageInterface;
-use Drupal\Core\PhpStorage\PhpStorageFactory;
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Language\Language;
@@ -105,7 +104,7 @@ class ConfigurableLanguageManager extends LanguageManager implements Configurabl
    * {@inheritdoc}
    */
   public static function rebuildServices() {
-    PhpStorageFactory::get('service_container')->deleteAll();
+    \Drupal::service('kernel')->invalidateContainer();
   }
 
   /**
diff --git a/core/modules/language/src/EventSubscriber/ConfigSubscriber.php b/core/modules/language/src/EventSubscriber/ConfigSubscriber.php
index ef3f65d..d3486aa 100644
--- a/core/modules/language/src/EventSubscriber/ConfigSubscriber.php
+++ b/core/modules/language/src/EventSubscriber/ConfigSubscriber.php
@@ -9,9 +9,9 @@
 
 use Drupal\Core\Language\LanguageDefault;
 use Drupal\Core\Language\LanguageManagerInterface;
-use Drupal\Core\PhpStorage\PhpStorageFactory;
 use Drupal\Core\Config\ConfigCrudEvent;
 use Drupal\Core\Config\ConfigEvents;
+use Drupal\language\ConfigurableLanguageManager;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
@@ -62,9 +62,8 @@ public function onConfigSave(ConfigCrudEvent $event) {
         $this->languageManager->reset();
         language_negotiation_url_prefixes_update();
       }
-      // Trigger a container rebuild on the next request by deleting compiled
-      // from PHP storage.
-      PhpStorageFactory::get('service_container')->deleteAll();
+      // Trigger a container rebuild on the next request by invalidating it.
+      ConfigurableLanguageManager::rebuildServices();
     }
   }
 
