diff --git a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
index 977fc2c8e9ff3cc767c72817480744dbde650dba..889d2667270f992eec837f60c79b33a9638cd84b 100644
--- a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
+++ b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
@@ -46,6 +46,13 @@ class OptimizedPhpArrayDumper extends Dumper {
    */
   protected $serialize = TRUE;
 
+  /**
+   * A list of container aliases.
+   *
+   * @var array
+   */
+  protected $aliases;
+
   /**
    * {@inheritdoc}
    */
@@ -61,8 +68,9 @@ public function dump(array $options = []) {
    */
   public function getArray() {
     $definition = [];
+    // Warm aliases first.
     $this->aliases = $this->getAliases();
-    $definition['aliases'] = $this->getAliases();
+    $definition['aliases'] = $this->aliases;
     $definition['parameters'] = $this->getParameters();
     $definition['services'] = $this->getServiceDefinitions();
     $definition['frozen'] = $this->container->isCompiled();