diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index f6c69a5..3aff7c7 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -2480,6 +2480,12 @@ function drupal_container(Container $new_container = NULL, $rebuild = FALSE) {
 
     // Register the EntityManager.
     $container->register('plugin.manager.entity', 'Drupal\Core\Entity\EntityManager');
+
+    // Add the entity query factory.
+    // @todo Try to move this back to CoreBundle when all the code related to
+    // menu links is moved to menu_link.module.
+    $container->register('entity.query', 'Drupal\Core\Entity\Query\QueryFactory')
+      ->addArgument(new Reference('service_container'));
   }
   return $container;
 }
diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php
index bbc4e2e..876ab2f 100644
--- a/core/lib/Drupal/Core/CoreBundle.php
+++ b/core/lib/Drupal/Core/CoreBundle.php
@@ -64,10 +64,6 @@ public function build(ContainerBuilder $container) {
       ->setFactoryClass('Drupal\Core\Template\TwigFactory')
       ->setFactoryMethod('get');
 
-    // Add the entity query factory.
-    $container->register('entity.query', 'Drupal\Core\Entity\Query\QueryFactory')
-      ->addArgument(new Reference('service_container'));
-
     $container->register('router.dumper', 'Drupal\Core\Routing\MatcherDumper')
       ->addArgument(new Reference('database'));
     $container->register('router.builder', 'Drupal\Core\Routing\RouteBuilder')
