diff --git a/core/core.services.yml b/core/core.services.yml
index 6abd05ce92011dacff4b323fe950b5aaa4d92636..50d2640ca5b6bbbf70bbfd2c26373af3490e4ddd 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -274,8 +274,6 @@ services:
     calls:
       - [setRequest, ['@?request']]
       - [setContext, ['@?router.request_context']]
-    tags:
-      - { name: persist }
   link_generator:
     class: Drupal\Core\Utility\LinkGenerator
     arguments: ['@url_generator', '@module_handler', '@language_manager']
diff --git a/core/includes/update.inc b/core/includes/update.inc
index c45e01391421e4fb1ae18d767f76a7b4beb22dff..e8ff9bb61b8aea79f2f33b8bef2322f05c9106cf 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -108,6 +108,7 @@ function update_prepare_d8_bootstrap() {
   // Enable UpdateServiceProvider service overrides.
   // @see update_flush_all_caches()
   $GLOBALS['conf']['container_service_providers']['UpdateServiceProvider'] = 'Drupal\Core\DependencyInjection\UpdateServiceProvider';
+  $GLOBALS['conf']['update_service_provider_overrides'] = TRUE;
 
   // Check whether settings.php needs to be rewritten.
   $settings_exist = !empty($GLOBALS['config_directories']);
diff --git a/core/lib/Drupal/Core/DependencyInjection/UpdateServiceProvider.php b/core/lib/Drupal/Core/DependencyInjection/UpdateServiceProvider.php
index ee637ea0106397e6d8c5d99b89519900fffb05af..4776214a55a373b0897fbad9f5b4dffa633865d8 100644
--- a/core/lib/Drupal/Core/DependencyInjection/UpdateServiceProvider.php
+++ b/core/lib/Drupal/Core/DependencyInjection/UpdateServiceProvider.php
@@ -7,9 +7,8 @@
 
 namespace Drupal\Core\DependencyInjection;
 
-use Drupal\Core\DependencyInjection\ContainerBuilder;
-use Drupal\Core\DependencyInjection\ServiceProviderInterface;
 use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\HttpFoundation\Request;
 
 /**
  * ServiceProvider class for update.php service overrides.
@@ -18,33 +17,50 @@
  * and required to prevent various services from trying to retrieve data from
  * storages that do not exist yet.
  */
-class UpdateServiceProvider implements ServiceProviderInterface {
+class UpdateServiceProvider implements ServiceProviderInterface, ServiceModifierInterface {
 
   /**
    * {@inheritdoc}
    */
   public function register(ContainerBuilder $container) {
-    // Disable the Lock service.
-    $container
-      ->register('lock', 'Drupal\Core\Lock\NullLockBackend');
-
-    // Prevent config from accessing {cache_config}.
-    // @see $conf['cache_classes'], update_prepare_d8_bootstrap()
-    $container
-      ->register('config.storage', 'Drupal\Core\Config\FileStorage')
-      ->addArgument(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY));
-    $container->register('module_handler', 'Drupal\Core\Extension\UpdateModuleHandler')
-      ->addArgument('%container.modules%');
-    $container
-      ->register("cache_factory", 'Drupal\Core\Cache\MemoryBackendFactory');
-    $container
-      ->register('router.builder', 'Drupal\Core\Routing\RouteBuilderStatic');
-
-    $container->register('theme_handler', 'Drupal\Core\Extension\ThemeHandler')
-      ->addArgument(new Reference('config.factory'))
-      ->addArgument(new Reference('module_handler'))
-      ->addArgument(new Reference('cache.cache'))
-      ->addArgument(new Reference('info_parser'));
+    if (!empty($GLOBALS['conf']['update_service_provider_overrides'])) {
+      // Disable the Lock service.
+      $container
+        ->register('lock', 'Drupal\Core\Lock\NullLockBackend');
+
+      // Prevent config from accessing {cache_config}.
+      // @see $conf['cache_classes'], update_prepare_d8_bootstrap()
+      $container
+        ->register('config.storage', 'Drupal\Core\Config\FileStorage')
+        ->addArgument(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY));
+      $container->register('module_handler', 'Drupal\Core\Extension\UpdateModuleHandler')
+        ->addArgument('%container.modules%');
+      $container
+        ->register('cache_factory', 'Drupal\Core\Cache\MemoryBackendFactory');
+      $container
+        ->register('router.builder', 'Drupal\Core\Routing\RouteBuilderStatic');
+
+      $container->register('theme_handler', 'Drupal\Core\Extension\ThemeHandler')
+        ->addArgument(new Reference('config.factory'))
+        ->addArgument(new Reference('module_handler'))
+        ->addArgument(new Reference('cache.cache'))
+        ->addArgument(new Reference('info_parser'));
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function alter(ContainerBuilder $container) {
+    // Ensure that URLs generated for the home and admin pages don't have
+    // 'update.php' in them.
+    $request = Request::createFromGlobals();
+    $definition = $container->getDefinition('url_generator');
+    $definition->addMethodCall('setBasePath', array(str_replace('/core', '', $request->getBasePath()) . '/'));
+    // We need to set the script path to an empty string since the value
+    // determined by \Drupal\Core\Routing\UrlGenerator::setRequest() is invalid
+    // once '/core' has been removed from the base path.
+    $definition->addMethodCall('setScriptPath', array(''));
   }
 
 }
diff --git a/core/update.php b/core/update.php
index 527a7038646d1ad2b027d46dbb113bb212de458b..075bfdb7bb79b94ee2c646f7f5923b8b69653554 100644
--- a/core/update.php
+++ b/core/update.php
@@ -86,7 +86,7 @@ function update_helpful_links() {
  * while updates are running.
  */
 function update_flush_all_caches() {
-  unset($GLOBALS['conf']['container_service_providers']['UpdateServiceProvider']);
+  $GLOBALS['conf']['update_service_provider_overrides'] = FALSE;
   \Drupal::service('kernel')->updateModules(\Drupal::moduleHandler()->getModuleList());
 
   // No updates to run, so caches won't get flushed later.  Clear them now.