diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php
index 3b666a4..4da3809 100644
--- a/core/modules/migrate/src/Plugin/Migration.php
+++ b/core/modules/migrate/src/Plugin/Migration.php
@@ -662,10 +662,33 @@ public function setTrackLastImported($track_last_imported) {
    * {@inheritdoc}
    */
   public function getMigrationDependencies() {
-    return ($this->migration_dependencies ?: []) + ['required' => [], 'optional' => []];
+    $this->migration_dependencies = ($this->migration_dependencies ?: []) + ['required' => [], 'optional' => []];
+    $this->migration_dependencies['optional'] = array_unique(array_merge($this->migration_dependencies['optional'], $this->findMigrationDependencies($this->getProcess())));
+    return $this->migration_dependencies;
   }
 
   /**
+   * Find migration dependencies from the migration and the iterator plugins.
+   *
+   * @param $process
+   * @return array
+   */
+  protected function findMigrationDependencies($process) {
+    $return = [];
+    foreach ($process as $process_pipeline) {
+      foreach ($process_pipeline as $plugin_configuration) {
+        if ($plugin_configuration['plugin'] == 'migration') {
+          $return = array_merge($return, (array) $plugin_configuration['migration']);
+        }
+        if ($plugin_configuration['plugin'] == 'iterator') {
+          $return = array_merge($return, $this->findMigrationDependencies($this->getProcessNormalized($plugin_configuration['process'])));
+        }
+      }
+    }
+    return $return;
+   }
+
+  /**
    * {@inheritdoc}
    */
   public function getPluginDefinition() {
diff --git a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php
index 35c4da7..63fc8a5 100644
--- a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php
+++ b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php
@@ -33,10 +33,31 @@ public function testGetProcessPlugins() {
    * @covers ::getMigrationDependencies
    */
   public function testGetMigrationDependencies() {
-    $migration = \Drupal::service('plugin.manager.migration')->createStubMigration([
+    $plugin_manager = \Drupal::service('plugin.manager.migration');
+    $migration = $plugin_manager->createStubMigration([
         'migration_dependencies' => NULL
     ]);
     $this->assertNotEmpty($migration->getMigrationDependencies(), 'Migration dependencies is not empty');
+    $plugin_definition = [
+      'process' => [
+        'f1' => 'bar',
+        'f2' => [
+          'plugin' => 'migration',
+          'migration' => 'm1'
+        ],
+        'f3' => [
+          'plugin' => 'iterator',
+          'process' => [
+            'target_id' => [
+              'plugin' => 'migration',
+              'migration' => 'm2',
+            ],
+          ],
+        ],
+      ],
+    ];
+    $migration = $plugin_manager->createStubMigration($plugin_definition);
+    $this->assertSame(['required' => [], 'optional' => ['m1', 'm2']], $migration->getMigrationDependencies());
   }
 
 }
