diff --git a/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php
index bd1c78b..4f7f159 100644
--- a/core/lib/Drupal/Core/Config/ConfigManager.php
+++ b/core/lib/Drupal/Core/Config/ConfigManager.php
@@ -188,6 +188,25 @@ public function uninstall($type, $name) {
     // Remove all dependent configuration entities.
     $dependent_entities = $this->findConfigEntityDependentsAsEntities($type, array($name));
 
+    // Give config entities a chance to become independent of the entities we
+    // are going to revove.
+    foreach (array_reverse($dependent_entities) as $entity) {
+      $entity_dependency_ids = $entity->calculateDependencies()['entity'];
+      $calculated_entity_dependencies = array();
+      foreach ($dependent_entities as $entity) {
+        if (in_array($entity->id(), $entity_dependency_ids)) {
+          $calculated_entity_dependencies[] = $entity;
+        }
+      }
+      if ($calculated_entity_dependencies) {
+        $entity->preDeleteFixDependencies($calculated_entity_dependencies);
+      }
+    }
+
+    // Recalculate the dependencies, some config entities may have fixed their
+    // dependencies on the to-be-removed entities.
+    $dependent_entities = $this->findConfigEntityDependentsAsEntities($type, array($name));
+
     // Reverse the array to that entities are removed in the correct order of
     // dependence. For example, this ensures that field instances are removed
     // before fields.
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
index 318ad7a..50b73e2 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
@@ -355,4 +355,10 @@ public function getConfigDependencyName() {
     return $this->getEntityType()->getConfigPrefix() . '.' . $this->id();
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function preDeleteFixDependencies(array $dependent_entities) {
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php
index b355cb5..1b82c44 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php
@@ -20,6 +20,13 @@
   /**
    * Enables the configuration entity.
    *
+   * @param \Drupal\Core\Config\Entity\ConfigEntityInterface[]
+   */
+  public function preDeleteFixDependencies(array $dependent_entities);
+
+  /**
+   * Enables the configuration entity.
+   *
    * @return $this
    */
   public function enable();
diff --git a/core/modules/entity/src/EntityDisplayBase.php b/core/modules/entity/src/EntityDisplayBase.php
index 07679f8..7ef4db6 100644
--- a/core/modules/entity/src/EntityDisplayBase.php
+++ b/core/modules/entity/src/EntityDisplayBase.php
@@ -389,4 +389,20 @@ private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) {
     return $definition->getDisplayOptions($this->displayContext);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function preDeleteFixDependencies(array $dependent_entities) {
+    $changed = FALSE;
+    foreach ($dependent_entities as $entity) {
+      if ($entity instanceof FieldInstanceConfig) {
+        $this->removeComponent($entity->getName());
+        $changed = TRUE;
+      }
+    }
+    if ($changed) {
+      $this->save();
+    }
+  }
+
 }
