diff --git a/core/includes/common.inc b/core/includes/common.inc
index 97b73f4..acf57da 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -4838,9 +4838,6 @@ function _drupal_bootstrap_code() {
   require_once DRUPAL_ROOT . '/core/includes/schema.inc';
   require_once DRUPAL_ROOT . '/core/includes/entity.inc';
 
-  // Load all enabled modules
-  drupal_container()->get('module_handler')->loadAll();
-
   // Make sure all stream wrappers are registered.
   file_get_stream_wrappers();
 
diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php
index c45c1cd..2ff2049 100644
--- a/core/lib/Drupal/Core/Extension/ModuleHandler.php
+++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php
@@ -417,6 +417,11 @@ public function alter($type, &$data, &$context1 = NULL, &$context2 = NULL) {
    */
   protected function getImplementationInfo($hook) {
     if (isset($this->implementations[$hook])) {
+      // If there are any implementations, assume that module functions will be
+      // called shortly aftewards, so load all modules now.
+      if (!empty($this->implementations[$hook]) && !$this->loaded) {
+        $this->loadAll();
+      }
       return $this->implementations[$hook];
     }
     $this->implementations[$hook] = array();
