diff --git a/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php b/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php
index b9dd9e659d..02f7c02428 100644
--- a/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php
+++ b/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php
@@ -5,6 +5,7 @@
 use Drupal\Component\Plugin\Definition\PluginDefinitionInterface;
 use Drupal\Component\Plugin\DependentPluginInterface;
 use Drupal\Component\Plugin\PluginInspectionInterface;
+use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Entity\DependencyTrait;
 use Drupal\Core\Plugin\Definition\DependentPluginDefinitionInterface;
 
@@ -16,7 +17,7 @@
   use DependencyTrait;
 
   /**
-   * Calculates and adds dependencies of a specific plugin instance.
+   * Calculates and returns dependencies of a specific plugin instance.
    *
    * Dependencies are added for the module that provides the plugin, as well
    * as any dependencies declared by the instance's calculateDependencies()
@@ -25,28 +26,47 @@
    *
    * @param \Drupal\Component\Plugin\PluginInspectionInterface $instance
    *   The plugin instance.
+   *
+   * @return array
+   *   An array of dependencies keyed by the type of dependency.
    */
-  protected function calculatePluginDependencies(PluginInspectionInterface $instance) {
+  protected function getPluginDependencies(PluginInspectionInterface $instance) {
+    $dependencies = [];
     $definition = $instance->getPluginDefinition();
-
     if ($definition instanceof PluginDefinitionInterface) {
-      $this->addDependency('module', $definition->getProvider());
+      $dependencies['module'][] = $definition->getProvider();
       if ($definition instanceof DependentPluginDefinitionInterface && $config_dependencies = $definition->getConfigDependencies()) {
-        $this->addDependencies($config_dependencies);
+        $dependencies = NestedArray::mergeDeep($dependencies, $config_dependencies);
       }
     }
     elseif (is_array($definition)) {
-      $this->addDependency('module', $definition['provider']);
+      $dependencies['module'][] = $definition['provider'];
       // Plugins can declare additional dependencies in their definition.
       if (isset($definition['config_dependencies'])) {
-        $this->addDependencies($definition['config_dependencies']);
+        $dependencies = NestedArray::mergeDeep($dependencies, $definition['config_dependencies']);
       }
     }
 
     // If a plugin is dependent, calculate its dependencies.
     if ($instance instanceof DependentPluginInterface && $plugin_dependencies = $instance->calculateDependencies()) {
-      $this->addDependencies($plugin_dependencies);
+      $dependencies = NestedArray::mergeDeep($dependencies, $plugin_dependencies);
     }
+    return $dependencies;
+  }
+
+  /**
+   * Calculates and adds dependencies of a specific plugin instance.
+   *
+   * Dependencies are added for the module that provides the plugin, as well
+   * as any dependencies declared by the instance's calculateDependencies()
+   * method, if it implements
+   * \Drupal\Component\Plugin\DependentPluginInterface.
+   *
+   * @param \Drupal\Component\Plugin\PluginInspectionInterface $instance
+   *   The plugin instance.
+   */
+  protected function calculatePluginDependencies(PluginInspectionInterface $instance) {
+    $this->addDependencies($this->getPluginDependencies($instance));
   }
 
 }
diff --git a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
index 2582d5c7ed..d8e71fa7e0 100644
--- a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
+++ b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
@@ -2,9 +2,6 @@
 
 namespace Drupal\layout_builder\Entity;
 
-use Drupal\Component\Plugin\DependentPluginInterface;
-use Drupal\Component\Plugin\PluginInspectionInterface;
-use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Entity\Entity\EntityViewDisplay as BaseEntityViewDisplay;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\FieldableEntityInterface;
@@ -232,32 +229,6 @@ public function onDependencyRemoval(array $dependencies) {
     return $changed;
   }
 
-  /**
-   * Calculates and returns dependencies of a specific plugin instance.
-   *
-   * @param \Drupal\Component\Plugin\PluginInspectionInterface $instance
-   *   The plugin instance.
-   *
-   * @return array
-   *   An array of dependencies keyed by the type of dependency.
-   *
-   * @todo Replace this in https://www.drupal.org/project/drupal/issues/2939925.
-   */
-  protected function getPluginDependencies(PluginInspectionInterface $instance) {
-    $definition = $instance->getPluginDefinition();
-    $dependencies['module'][] = $definition['provider'];
-    // Plugins can declare additional dependencies in their definition.
-    if (isset($definition['config_dependencies'])) {
-      $dependencies = NestedArray::mergeDeep($dependencies, $definition['config_dependencies']);
-    }
-
-    // If a plugin is dependent, calculate its dependencies.
-    if ($instance instanceof DependentPluginInterface && $plugin_dependencies = $instance->calculateDependencies()) {
-      $dependencies = NestedArray::mergeDeep($dependencies, $plugin_dependencies);
-    }
-    return $dependencies;
-  }
-
   /**
    * {@inheritdoc}
    */
diff --git a/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php
index 844c8152d3..f76fc672fe 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php
@@ -16,10 +16,25 @@
  */
 class PluginDependencyTraitTest extends UnitTestCase {
 
+  /**
+   * @covers ::getPluginDependencies
+   *
+   * @dataProvider providerTestPluginDependencies
+   */
+  public function testGetPluginDependencies(ProphecyInterface $plugin, $definition, array $expected) {
+    $test_class = new TestPluginDependency();
+
+    $plugin->getPluginDefinition()->willReturn($definition);
+
+    $actual = $test_class->getPluginDependencies($plugin->reveal());
+    $this->assertEquals($expected, $actual);
+    $this->assertEmpty($test_class->getDependencies());
+  }
+
   /**
    * @covers ::calculatePluginDependencies
    *
-   * @dataProvider providerTestCalculatePluginDependencies
+   * @dataProvider providerTestPluginDependencies
    *
    * @param \Prophecy\Prophecy\ProphecyInterface $plugin
    *   A prophecy of a plugin instance.
@@ -38,9 +53,9 @@ public function testCalculatePluginDependencies(ProphecyInterface $plugin, $defi
   }
 
   /**
-   * Provides test data for ::testCalculatePluginDependencies().
+   * Provides test data for plugin dependencies.
    */
-  public function providerTestCalculatePluginDependencies() {
+  public function providerTestPluginDependencies() {
     $data = [];
 
     $plugin = $this->prophesize(PluginInspectionInterface::class);
@@ -111,6 +126,7 @@ class TestPluginDependency {
 
   use PluginDependencyTrait {
     calculatePluginDependencies as public;
+    getPluginDependencies as public;
   }
 
   /**
