diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 072e109..7ecc321 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -49,6 +49,15 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface {
   protected $newModuleList;
 
   /**
+   * Holds the information if the moduleList changed
+   *
+   * @var boolean
+   *   Container is rebuild if this var is TRUE during boot()
+   *   and $this->newModuleList is set.
+   */
+  protected $moduleListChanged;
+
+  /**
    * An array of module data objects.
    *
    * The data objects have the same data structure as returned by
@@ -203,7 +212,9 @@ public function updateModules(array $module_list, array $module_paths = array())
     // 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) {
+    $this->moduleListChanged = isset($this->newModuleList) && isset($this->moduleList) && $this->getBundleClasses($this->moduleList) !== $this->getBundleClasses($this->newModuleList);
+
+    if ($this->booted && $this->moduleListChanged) {
       drupal_container(NULL, TRUE);
       $this->booted = FALSE;
       $this->boot();
@@ -211,6 +222,27 @@ public function updateModules(array $module_list, array $module_paths = array())
   }
 
   /**
+   * 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($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;
+  }
+
+  /**
    * Returns the classname based on environment, debug and testing prefix.
    *
    * @return string
@@ -249,8 +281,9 @@ protected function initializeContainer() {
     }
     // First check whether the list of modules changed in this request.
     if (isset($this->newModuleList)) {
-      if (isset($this->container) && isset($this->moduleList) && array_keys($this->moduleList) !== array_keys($this->newModuleList)) {
+      if ($this->moduleListChanged) {
         unset($this->container);
+        $this->moduleListChanged = FALSE;
       }
       $this->moduleList = $this->newModuleList;
       unset($this->newModuleList);
