diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
index b6c73e5..d9b7633 100644
--- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
@@ -486,7 +486,7 @@ public function onDependencyRemoval(array $dependencies) {
           }
           // If there are unresolved deleted dependencies left, disable this
           // component to avoid the removal of the entire display entity.
-          if ($this->getPluginRemovedDependencies($renderer->calculateDependencies(), $dependencies)) {
+          if ($this->getPluginRemovedDependencies($renderer->calculatePluginDependencies(), $dependencies)) {
             $this->removeComponent($name);
             $arguments = [
               '@display' => (string) $this->getEntityType()->getLabel(),
diff --git a/core/lib/Drupal/Core/Field/PluginSettingsBase.php b/core/lib/Drupal/Core/Field/PluginSettingsBase.php
index a6196ec..d52a202 100644
--- a/core/lib/Drupal/Core/Field/PluginSettingsBase.php
+++ b/core/lib/Drupal/Core/Field/PluginSettingsBase.php
@@ -138,6 +138,24 @@ public function getThirdPartyProviders() {
    * {@inheritdoc}
    */
   public function calculateDependencies() {
+    $types = ['module', 'theme', 'config', 'content'];
+    $default = array_combine($types, array_fill_keys($types, []));
+    $plugin_dependencies = $this->calculatePluginDependencies() + $default;
+    $third_party_dependencies = $this->calculateThirdPartyDependencies() + $default;
+
+    $dependencies = [];
+    foreach ($types as $type) {
+      $dependencies[$type] = array_values(array_unique(array_merge($plugin_dependencies[$type], $third_party_dependencies[$type])));
+    }
+
+    return array_filter($dependencies);
+  }
+
+  public function calculatePluginDependencies() {
+    return [];
+  }
+
+  public function calculateThirdPartyDependencies() {
     if (!empty($this->thirdPartySettings)) {
       // Create dependencies on any modules providing third party settings.
       return array(
diff --git a/core/modules/system/tests/modules/entity_test_third_party/config/schema/entity_test_third_party.schema.yml b/core/modules/system/tests/modules/entity_test_third_party/config/schema/entity_test_third_party.schema.yml
new file mode 100644
index 0000000..1c9800e
--- /dev/null
+++ b/core/modules/system/tests/modules/entity_test_third_party/config/schema/entity_test_third_party.schema.yml
@@ -0,0 +1,7 @@
+core.entity_view_display.*.*.*.third_party.entity_test_third_party:
+  type: mapping
+  label: 'Schema for entity_test module additions to entity_view_display entity'
+  mapping:
+    key:
+      type: string
+      label: 'Label for key'
diff --git a/core/modules/system/tests/modules/entity_test_third_party/entity_test_third_party.info.yml b/core/modules/system/tests/modules/entity_test_third_party/entity_test_third_party.info.yml
new file mode 100644
index 0000000..c566407
--- /dev/null
+++ b/core/modules/system/tests/modules/entity_test_third_party/entity_test_third_party.info.yml
@@ -0,0 +1,8 @@
+name: 'Entity test third-party settings module'
+type: module
+description: 'Provides third-party settings for test entity types.'
+package: Testing
+version: VERSION
+core: 8.x
+dependencies:
+  - entity_test
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayBaseTest.php
index 137201a..3804c2a 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayBaseTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDisplayBaseTest.php
@@ -2,7 +2,11 @@
 
 namespace Drupal\KernelTests\Core\Entity;
 
+use Drupal\comment\Entity\CommentType;
 use Drupal\Core\Entity\Entity\EntityViewDisplay;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\field\Entity\FieldConfig;
+use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\KernelTests\KernelTestBase;
 
 /**
@@ -15,7 +19,7 @@ class EntityDisplayBaseTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['entity_test'];
+  public static $modules = ['entity_test', 'entity_test_third_party', 'field', 'system', 'comment'];
 
   /**
    * @covers ::preSave
@@ -54,4 +58,97 @@ public function testPreSave() {
     $this->assertSame('content', $component['region']);
   }
 
+  /**
+   * @covers ::onDependencyRemoval
+   */
+  public function testOnDependencyRemoval() {
+    // Create a comment field for entity_test.
+    $comment_bundle = CommentType::create([
+      'id' => 'entity_test',
+      'label' => 'entity_test',
+      'description' => '',
+      'target_entity_type_id' => 'entity_test',
+    ]);
+    $comment_bundle->save();
+    $comment_display = EntityViewDisplay::create([
+      'targetEntityType' => 'comment',
+      'bundle' => 'entity_test',
+      'mode' => 'default',
+      'status' => TRUE,
+      'third_party_settings' => [
+        'entity_test_third_party' => [
+          'key' => 'value',
+        ],
+      ],
+    ]);
+    $comment_display->save();
+    $field_storage = FieldStorageConfig::create([
+      'entity_type' => 'entity_test',
+      'field_name' => 'test_field',
+      'type' => 'comment',
+      'settings' => [
+        'comment_type' => 'entity_test',
+      ],
+    ]);
+    $field_storage->save();
+    $field = FieldConfig::create([
+      'field_storage' => $field_storage,
+      'label' => $this->randomMachineName(),
+      'bundle' => 'entity_test',
+    ]);
+    $field->save();
+
+    // Create an entity view display for entity_test.
+    $entity_display = EntityViewDisplay::create([
+      'targetEntityType' => 'entity_test',
+      'bundle' => 'entity_test',
+      'mode' => 'default',
+      'status' => TRUE,
+      'content' => [
+        'test_field' => ['type' => 'comment_default', 'region' => 'content', 'settings' => ['view_mode' => 'default'], 'label' => 'hidden', 'third_party_settings' => []],
+      ],
+      'third_party_settings' => [
+        'entity_test_third_party' => [
+          'key' => 'value',
+        ],
+      ],
+    ]);
+    $entity_display->save();
+
+    $expected_component = [
+      'type' => 'comment_default',
+      'region' => 'content',
+      'settings' => ['view_mode' => 'default'],
+      'label' => 'hidden',
+      'third_party_settings' => [],
+    ];
+    $entity_display->getComponent('test_field');
+    $this->assertEquals($expected_component, $entity_display->getComponent('test_field'));
+    $expected_dependencies = [
+      'config' => [
+        'core.entity_view_display.comment.entity_test.default',
+        'field.field.entity_test.entity_test.test_field',
+      ],
+      'module' => [
+        'comment',
+        'entity_test',
+        'entity_test_third_party',
+      ],
+    ];
+    $this->assertSame($expected_dependencies, $entity_display->getDependencies());
+
+    // Uninstall the third-party settings provider and reload the display.
+    $this->container->get('module_installer')->uninstall(['entity_test_third_party']);
+    $entity_display = EntityViewDisplay::load('entity_test.entity_test.default');
+
+    // The component should remain unchanged.
+    $this->assertEquals($expected_component, $entity_display->getComponent('test_field'));
+    // The dependencies should no longer contain 'entity_test_third_party'.
+    $expected_dependencies['module'] = [
+      'comment',
+      'entity_test',
+    ];
+    $this->assertSame($expected_dependencies, $entity_display->getDependencies());
+  }
+
 }
