diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php
index b023764ebf..6c5b46e7ba 100644
--- a/core/lib/Drupal/Core/Config/ConfigInstaller.php
+++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php
@@ -117,19 +117,15 @@ public function installDefaultConfig($type, $name) {
         $prefix = $name . '.';
       }
 
-      // Gets profile storages to search for overrides if necessary.
-      $profile_storages = $this->getProfileStorages($name);
+      // Gets profile storages to search for overrides if necessary but only if
+      // the configuration is being installed outside of a profile/site
+      // installation.
+      $profile_storages = $this->drupalInstallationAttempted() ? [] : $this->getProfileStorages($name);
 
       // Gather information about all the supported collections.
       $collection_info = $this->configManager->getConfigCollectionInfo();
       foreach ($collection_info->getCollectionNames() as $collection) {
         $config_to_create = $this->getConfigToCreate($storage, $collection, $prefix, $profile_storages);
-        // If we're installing a profile ensure configuration that is overriding
-        // is excluded.
-        if ($name == $this->drupalGetProfile()) {
-          $existing_configuration = $this->getActiveStorages($collection)->listAll();
-          $config_to_create = array_diff_key($config_to_create, array_flip($existing_configuration));
-        }
         if (!empty($config_to_create)) {
           $this->createConfiguration($collection, $config_to_create);
         }
@@ -460,8 +456,10 @@ public function checkConfigurationToInstall($type, $name) {
     $enabled_extensions = $this->getEnabledExtensions();
     // Add the extension that will be enabled to the list of enabled extensions.
     $enabled_extensions[] = $name;
-    // Gets profile storages to search for overrides if necessary.
-    $profile_storages = $this->getProfileStorages($name);
+    // Gets profile storages to search for overrides if necessary but only if
+    // the configuration is being installed outside of a profile/site
+    // installation.
+    $profile_storages = $this->drupalInstallationAttempted() ? [] : $this->getProfileStorages($name);
 
     // Check the dependencies of configuration provided by the module.
     list($invalid_default_config, $missing_dependencies) = $this->findDefaultConfigWithUnmetDependencies($storage, $enabled_extensions, $profile_storages);
diff --git a/core/modules/config/src/Tests/ConfigInstallProfileUnmetDependenciesTest.php b/core/modules/config/src/Tests/ConfigInstallProfileUnmetDependenciesTest.php
index 6683580eab..4ffbc92e74 100644
--- a/core/modules/config/src/Tests/ConfigInstallProfileUnmetDependenciesTest.php
+++ b/core/modules/config/src/Tests/ConfigInstallProfileUnmetDependenciesTest.php
@@ -7,7 +7,13 @@
 use Drupal\simpletest\InstallerTestBase;
 
 /**
- * Tests install profile config overrides can not add unmet dependencies.
+ * Tests install profile config overrides can create inter-module dependencies.
+ *
+ * Tests successful installation in the case if there are two modules A and B
+ * and they don't have any dependencies between each other and A is installed
+ * before B during the site installation, but A provides a default config,
+ * which is overridden in the profile and there a dependency to module B is
+ * added.
  *
  * @group Config
  */
@@ -45,7 +51,8 @@ protected function setUp() {
     }
 
     // Add a dependency that can not be met because User is installed before
-    // Action.
+    // Action in order to ensure the default module config will be used during
+    // the module installation instead the profile override one.
     $config_file = $dest . DIRECTORY_SEPARATOR . InstallStorage::CONFIG_INSTALL_DIRECTORY . DIRECTORY_SEPARATOR . 'system.action.user_block_user_action.yml';
     $action = Yaml::decode(file_get_contents($config_file));
     $action['dependencies']['module'][] = 'action';
@@ -76,21 +83,32 @@ protected function error($message = '', $group = 'Other', array $caller = NULL)
    * {@inheritdoc}
    */
   protected function setUpSite() {
-    // This step is not reached due to the exception.
+    if ($this->expectedException) {
+      // This step is not reached due to the exception.
+    }
+    else {
+      parent::setUpSite();
+    }
   }
 
-
   /**
    * Confirms that the installation succeeded.
    */
   public function testInstalled() {
     if ($this->expectedException) {
-      $this->pass('Expected Drupal\Core\Config\UnmetDependenciesException exception thrown');
+      $this->fail('Unexpected Drupal\Core\Config\UnmetDependenciesException exception thrown');
     }
     else {
-      $this->fail('Expected Drupal\Core\Config\UnmetDependenciesException exception thrown');
+      $this->pass('Drupal\Core\Config\UnmetDependenciesException exception not thrown');
+
+      // Ensure the overridden config in the profile has been installed.
+      /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
+      $config_manager = $this->container->get('config.manager');
+      $entity_label = $config_manager->loadConfigEntityByName('system.action.user_block_user_action')
+        ->label();
+      $this->assertEqual('Overridden block the selected user(s)', $entity_label);
     }
-    $this->assertErrorLogged('Configuration objects provided by <em class="placeholder">user</em> have unmet dependencies: <em class="placeholder">system.action.user_block_user_action (action)</em>');
+    $this->assertNoErrorsLogged();
   }
 
 }
