diff --git a/core/modules/comment/comment.post_update.php b/core/modules/comment/comment.post_update.php
index 04bf2db28d..95c78ae3a9 100644
--- a/core/modules/comment/comment.post_update.php
+++ b/core/modules/comment/comment.post_update.php
@@ -7,6 +7,8 @@
 
 use Drupal\Core\Config\FileStorage;
 use Drupal\Core\Config\InstallStorage;
+use Drupal\comment\Entity\CommentType;
+use Drupal\comment\CommentTypeInterface;
 
 /**
  * Enable the comment admin view.
@@ -36,3 +38,17 @@ function comment_post_update_enable_comment_admin_view() {
     ->create($storage->read('views.view.comment'))
     ->save();
 }
+
+/**
+ * Saves the dependency on the entity provider into comment_type entities.
+ */
+function comment_post_update_provider_dependency() {
+  $comment_types = CommentType::loadMultiple();
+  array_walk($comment_types, function (CommentTypeInterface $comment_type) {
+    // Make sure that a definition exists for the target entity. The providing
+    // module may have been uninstalled.
+    if (\Drupal::entityTypeManager()->hasDefinition($comment_type->getTargetEntityTypeId())) {
+      $comment_type->save();
+    }
+  });
+}
diff --git a/core/modules/comment/src/Entity/CommentType.php b/core/modules/comment/src/Entity/CommentType.php
index a773c58332..34c8671705 100644
--- a/core/modules/comment/src/Entity/CommentType.php
+++ b/core/modules/comment/src/Entity/CommentType.php
@@ -99,4 +99,15 @@ public function getTargetEntityTypeId() {
     return $this->target_entity_type_id;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function calculateDependencies() {
+    parent::calculateDependencies();
+    $target_entity_type = $this->entityTypeManager()->getDefinition($this->getTargetEntityTypeId());
+    $this->addDependency('module', $target_entity_type->getProvider());
+    return $this;
+  }
+
+
 }
diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
index 291f9dc3e1..91fcdbe2c4 100644
--- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
@@ -188,4 +188,16 @@ public function testCommentTypeDeletion() {
     $this->assertRaw(t('The comment type %label has been deleted.', ['%label' => $type->label()]));
   }
 
+  /**
+   * Tests that the provider of the target entity is listed as a dependency.
+   */
+  public function testCalculateDependencies() {
+    // Create a comment type programmatically.
+    $comment_type = $this->createCommentType('dep_test');
+    $target_entity_type = \Drupal::entityTypeManager()->getDefinition($comment_type->getTargetEntityTypeId());
+    $dependencies = $comment_type->getDependencies() + ['module' => []];
+    $this->assertTrue(in_array($target_entity_type->getProvider(), $dependencies['module']));
+  }
+
+
 }
diff --git a/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php b/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php
index e623132bbb..ea11332ebf 100644
--- a/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php
+++ b/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php
@@ -71,4 +71,32 @@ public function testPublishedEntityKey() {
     $this->assertTrue(\Drupal::database()->schema()->indexExists('comment_field_data', 'comment__status_comment_type'));
   }
 
+  /**
+   * Tests comment_post_update_provider_dependency().
+   *
+   * @see comment_post_update_provider_dependency()
+   */
+  public function testPostUpdateCommentTypeDependencies() {
+    $default_comment_type = 'comment.type.comment';
+    $forum_comment_type = 'comment.type.comment_forum';
+
+    // Check that default comment type does not depend on the node module.
+    $dependencies = $this->config($default_comment_type)->get('dependencies.module') ?: [];
+    $this->assertFalse(in_array('node', $dependencies));
+
+    // Check that forum comment type does not depend on the node module.
+    $dependencies = $this->config($forum_comment_type)->get('dependencies.module') ?: [];
+    $this->assertFalse(in_array('node', $dependencies));
+
+    $this->runUpdates();
+
+    // Check that default comment type depends on the node module.
+    $dependencies = $this->config($default_comment_type)->get('dependencies.module') ?: [];
+    $this->assertTrue(in_array('node', $dependencies));
+
+    // Check that forum comment type depends on the node module.
+    $dependencies = $this->config($forum_comment_type)->get('dependencies.module') ?: [];
+    $this->assertTrue(in_array('node', $dependencies));
+  }
+
 }
diff --git a/core/modules/comment/tests/src/Kernel/CommentIntegrationTest.php b/core/modules/comment/tests/src/Kernel/CommentIntegrationTest.php
index af730346cb..feaf51d048 100644
--- a/core/modules/comment/tests/src/Kernel/CommentIntegrationTest.php
+++ b/core/modules/comment/tests/src/Kernel/CommentIntegrationTest.php
@@ -37,6 +37,7 @@ protected function setUp() {
     CommentType::create([
       'id' => 'comment',
       'label' => $this->randomString(),
+      'target_entity_type_id' => 'entity_test',
     ])->save();
   }
 
diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php
index 576e86a795..5add0d93ee 100644
--- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php
+++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php
@@ -42,26 +42,32 @@ protected function setUp() {
     CommentType::create([
       'id' => 'comment_node_page',
       'label' => $this->randomMachineName(),
+      'target_entity_type_id' => 'node',
     ])->save();
     CommentType::create([
       'id' => 'comment_node_article',
       'label' => $this->randomMachineName(),
+      'target_entity_type_id' => 'node',
     ])->save();
     CommentType::create([
       'id' => 'comment_node_blog',
       'label' => $this->randomMachineName(),
+      'target_entity_type_id' => 'node',
     ])->save();
     CommentType::create([
       'id' => 'comment_node_book',
       'label' => $this->randomMachineName(),
+      'target_entity_type_id' => 'node',
     ])->save();
     CommentType::create([
       'id' => 'comment_forum',
       'label' => $this->randomMachineName(),
+      'target_entity_type_id' => 'node',
     ])->save();
     CommentType::create([
       'id' => 'comment_node_test_content_type',
       'label' => $this->randomMachineName(),
+      'target_entity_type_id' => 'node',
     ])->save();
 
     NodeType::create([
diff --git a/core/modules/forum/config/optional/comment.type.comment_forum.yml b/core/modules/forum/config/optional/comment.type.comment_forum.yml
index 44a2d6516f..224982c7ec 100644
--- a/core/modules/forum/config/optional/comment.type.comment_forum.yml
+++ b/core/modules/forum/config/optional/comment.type.comment_forum.yml
@@ -4,6 +4,8 @@ dependencies:
   enforced:
     module:
       - forum
+  module:
+    - node
 id: comment_forum
 label: Comment_forum
 target_entity_type_id: node
diff --git a/core/profiles/standard/config/install/comment.type.comment.yml b/core/profiles/standard/config/install/comment.type.comment.yml
index ddcbbc9860..14af64c7d6 100644
--- a/core/profiles/standard/config/install/comment.type.comment.yml
+++ b/core/profiles/standard/config/install/comment.type.comment.yml
@@ -1,6 +1,8 @@
 langcode: en
 status: true
-dependencies: {  }
+dependencies:
+  module:
+    - node
 id: comment
 label: 'Default comments'
 target_entity_type_id: node
