 core/core.services.yml                             |  5 ++
 .../MaintenanceModeConfigFactoryOverride.php       | 95 ++++++++++++++++++++++
 2 files changed, 100 insertions(+)

diff --git a/core/core.services.yml b/core/core.services.yml
index a8edbe4..1f91fd6 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -1030,6 +1030,11 @@ services:
     arguments: ['@maintenance_mode', '@config.factory', '@string_translation', '@url_generator', '@current_user', '@bare_html_page_renderer']
     tags:
       - { name: event_subscriber }
+  maintenance_mode.config_factory_override:
+    class: Drupal\system\Config\LanguageConfigFactoryOverride
+    arguments: ['@maintenance_mode', '@current_route_match']
+    tags:
+      - { name: config.factory.override, priority: -1000 }
   path_subscriber:
     class: Drupal\Core\EventSubscriber\PathSubscriber
     tags:
diff --git a/core/lib/Drupal/Core/Config/MaintenanceModeConfigFactoryOverride.php b/core/lib/Drupal/Core/Config/MaintenanceModeConfigFactoryOverride.php
index e69de29..e8a5653 100644
--- a/core/lib/Drupal/Core/Config/MaintenanceModeConfigFactoryOverride.php
+++ b/core/lib/Drupal/Core/Config/MaintenanceModeConfigFactoryOverride.php
@@ -0,0 +1,95 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Config\MaintenanceModeConfigFactoryOverride.
+ */
+
+namespace Drupal\Core\Config;
+
+use Drupal\Core\Cache\CacheableMetadata;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Site\MaintenanceModeInterface;
+
+/**
+ * Provides maintenance mode overrides for the configuration factory.
+ */
+class MaintenanceModeConfigFactoryOverride implements ConfigFactoryOverrideInterface {
+
+  /**
+   * The maintenance mode service
+   *
+   * @var \Drupal\Core\Site\MaintenanceModeInterface
+   */
+  protected $maintenanceMode;
+
+  /**
+   * The route match.
+   *
+   * @var \Drupal\Core\Routing\RouteMatchInterface
+   */
+  protected $routeMatch;
+
+  /**
+   * Constructs a MaintenanceModeConfigFactoryOverride service.
+   *
+   * @param \Drupal\Core\Site\MaintenanceModeInterface $maintenance_mode
+   *   The maintenance mode service.
+   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
+   *   The route match.
+   */
+  public function __construct(MaintenanceModeInterface $maintenance_mode, RouteMatchInterface $route_match) {
+    $this->maintenanceMode = $maintenance_mode;
+    $this->routeMatch = $route_match;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function loadOverrides($names) {
+    $overrides = array();
+    if ($this->maintenanceMode->applies($this->routeMatch)) {
+      if (in_array('system.performance', $names)) {
+        $overrides = [
+          'system.performance' => [
+            'css' => [
+              'preprocess' => FALSE,
+            ],
+            'js' => [
+              'preprocess' => FALSE,
+            ],
+          ]
+        ];
+      }
+    }
+    return $overrides;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCacheSuffix() {
+    return 'MaintenanceRoutesConfigFactoryOverride';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
+    return NULL;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCacheableMetadata($name) {
+    $cacheability = new CacheableMetadata();
+    if ($name === 'system.performance' && $this->maintenanceMode->applies($this->routeMatch)) {
+      // max-age=0 because maintenance mode depends on state, which can change
+      // at any time.
+      $cacheability->setCacheMaxAge(0);
+    }
+    return $cacheability;
+  }
+
+}
