diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 892571f..d707d06 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -114,11 +114,16 @@ public function registerBundles() {
    * Implements Drupal\Core\DrupalKernelInterface::updateModules().
    */
   public function updateModules($module_list) {
+    $old_module_list = $this->moduleList;
     $this->moduleList = $module_list;
     // If we haven't yet booted, we don't need to do anything: the new module
     // list will take effect when boot() is called. If we have already booted,
     // then reboot in order to refresh the bundle list and container.
-    if ($this->booted) {
+    if ($this->booted && $this->getBundleClasses($old_module_list) != $this->getBundleClasses($this->moduleList)) {
+      // Explicitly prevent old compiled containers from being used.
+      if ($this->compilationIndexCache) {
+        $this->compilationIndexCache->flush();
+      }
       drupal_container(NULL, TRUE);
       $this->booted = FALSE;
       $this->boot();
@@ -126,6 +131,27 @@ public function updateModules($module_list) {
   }
 
   /**
+   * Retrieves the name of bundle classes for a given list of modules.
+   *
+   * @param array $module_list
+   *   An associative array whose keys and values are the names of modules.
+   *
+   * @return array
+   *   An array whose values are bundle class names.
+   */
+  protected function getBundleClasses(array $module_list) {
+    $bundle_classes = array();
+    foreach ($module_list as $module) {
+      $camelized = ContainerBuilder::camelize($module);
+      $class = "Drupal\\{$module}\\{$camelized}Bundle";
+      if (class_exists($class)) {
+        $bundle_classes[] = $class;
+      }
+    }
+    return $bundle_classes;
+  }
+
+  /**
    * Initializes the service container.
    */
   protected function initializeContainer() {
