diff --git a/core/core.services.yml b/core/core.services.yml
index f767c313f0..31d82faf4d 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -150,10 +150,10 @@ services:
       - { name: cache.context }
   cache_context.route.menu_active_trails:
     class: Drupal\Core\Cache\Context\MenuActiveTrailsCacheContext
-    calls:
-      - [setContainer, ['@service_container']]
+    arguments: ['@menu.active_trail']
     tags:
       - { name: cache.context }
+    lazy: true
 
   # Complex cache contexts, that may be calculated from a combination of
   # multiple aspects of the request context plus additional logic. Hence they
diff --git a/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php b/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php
index db31384122..b05e2ac098 100644
--- a/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php
+++ b/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php
@@ -3,18 +3,25 @@
 namespace Drupal\Core\Cache\Context;
 
 use Drupal\Core\Cache\CacheableMetadata;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
+use Drupal\Core\Menu\MenuActiveTrail;
 
 /**
  * Defines the MenuActiveTrailsCacheContext service.
- *
- * This class is container-aware to avoid initializing the 'menu.active_trails'
- * service (and its dependencies) when it is not necessary.
  */
-class MenuActiveTrailsCacheContext implements CalculatedCacheContextInterface, ContainerAwareInterface {
+class MenuActiveTrailsCacheContext implements CalculatedCacheContextInterface {
 
-  use ContainerAwareTrait;
+  /**
+   * Constructs a new MenuActiveTrailsCacheContext service.
+   *
+   * @var \Drupal\Core\Menu\MenuActiveTrail|null $menuActiveTrail
+   *   The active menu trail service.
+   */
+  public function __construct(protected ?MenuActiveTrail $menuActiveTrail = NULL) {
+    if ($this->menuActiveTrail === NULL) {
+      @trigger_error('Calling ' . __METHOD__ . ' without the $menuActiveTrail argument is deprecated in drupal:10.2.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/666', E_USER_DEPRECATED);
+      $this->menuActiveTrail = \Drupal::service('menu.active_trail');
+    }
+  }
 
   /**
    * {@inheritdoc}
@@ -31,8 +38,7 @@ public function getContext($menu_name = NULL) {
       throw new \LogicException('No menu name provided for menu.active_trails cache context.');
     }
 
-    $active_trail = $this->container->get('menu.active_trail')
-      ->getActiveTrailIds($menu_name);
+    $active_trail = $this->menuActiveTrail->getActiveTrailIds($menu_name);
     return 'menu_trail.' . $menu_name . '|' . implode('|', $active_trail);
   }
 
diff --git a/core/modules/book/book.services.yml b/core/modules/book/book.services.yml
index 780a6bffa4..95d18f704e 100644
--- a/core/modules/book/book.services.yml
+++ b/core/modules/book/book.services.yml
@@ -29,12 +29,10 @@ services:
       - { name: access_check, applies_to: _access_book_removable }
   cache_context.route.book_navigation:
     class: Drupal\book\Cache\BookNavigationCacheContext
-    arguments: ['@current_route_match']
-    calls:
-      - [setContainer, ['@service_container']]
+    arguments: ['@current_route_match', '@book.manager']
     tags:
       - { name: cache.context}
-
+    lazy: true
   book.uninstall_validator:
     class: Drupal\book\BookUninstallValidator
     tags:
diff --git a/core/modules/book/src/Cache/BookNavigationCacheContext.php b/core/modules/book/src/Cache/BookNavigationCacheContext.php
index 1611dd5690..93e5cbcfbb 100644
--- a/core/modules/book/src/Cache/BookNavigationCacheContext.php
+++ b/core/modules/book/src/Cache/BookNavigationCacheContext.php
@@ -2,12 +2,11 @@
 
 namespace Drupal\book\Cache;
 
+use Drupal\book\BookManagerInterface;
 use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Cache\Context\CacheContextInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\node\NodeInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
 
 /**
  * Defines the book navigation cache context service.
@@ -17,13 +16,8 @@
  * This allows for book navigation location-aware caching. It depends on:
  * - whether the current route represents a book node at all
  * - and if so, where in the book hierarchy we are
- *
- * This class is container-aware to avoid initializing the 'book.manager'
- * service when it is not necessary.
  */
-class BookNavigationCacheContext implements CacheContextInterface, ContainerAwareInterface {
-
-  use ContainerAwareTrait;
+class BookNavigationCacheContext implements CacheContextInterface {
 
   /**
    * The current route match.
@@ -35,11 +29,17 @@ class BookNavigationCacheContext implements CacheContextInterface, ContainerAwar
   /**
    * Constructs a new BookNavigationCacheContext service.
    *
-   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
+   * @var \Drupal\Core\Routing\RouteMatchInterface $route_match
    *   The current route match.
+   * @var \Drupal\book\BookManagerInterface|null $bookManager
+   *   Book Manager Service.
    */
-  public function __construct(RouteMatchInterface $route_match) {
+  public function __construct(RouteMatchInterface $route_match, protected ?BookManagerInterface $bookManager = NULL) {
     $this->routeMatch = $route_match;
+    if ($this->bookManager === NULL) {
+      @trigger_error('Calling ' . __METHOD__ . ' without the $bookManager argument is deprecated in drupal:10.2.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/666', E_USER_DEPRECATED);
+      $this->bookManager = \Drupal::service('book.manager');
+    }
   }
 
   /**
@@ -66,7 +66,7 @@ public function getContext() {
     }
 
     // If we're looking at a book node, get the trail for that node.
-    $active_trail = $this->container->get('book.manager')
+    $active_trail = $this->bookManager
       ->getActiveTrailIds($node->book['bid'], $node->book);
     return implode('|', $active_trail);
   }
