diff --git a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
index 14a0a7abe5a699074170904ee7349a14afe82d5d..27b756904a97934655a35d65f1943fd0f229c87e 100644
--- a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
+++ b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
@@ -174,7 +174,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * Retrieves the hash of the source identifier values.
    *
-   * It is public only for testing purposes.
+   * @internal
    *
    * @param array $source_id_values
    *   The source identifiers
diff --git a/core/modules/migrate/src/Row.php b/core/modules/migrate/src/Row.php
index 2824dd92bcb51430a5259f5758ce3b25175b069a..95e7f28a0f6eda22adcea02666fb43fbeb12a5cb 100644
--- a/core/modules/migrate/src/Row.php
+++ b/core/modules/migrate/src/Row.php
@@ -106,10 +106,11 @@ public function __construct(array $values = [], array $source_ids = [], $is_stub
    * Retrieves the values of the source identifiers.
    *
    * @return array
-   *   An array containing the values of the source identifiers.
+   *   An array containing the values of the source identifiers. Returns values
+   *   in the same order as defined in $this->sourceIds.
    */
   public function getSourceIdValues() {
-    return array_intersect_key($this->source, $this->sourceIds);
+    return array_merge($this->sourceIds, array_intersect_key($this->source, $this->sourceIds));
   }
 
   /**
diff --git a/core/modules/migrate/tests/src/Unit/RowTest.php b/core/modules/migrate/tests/src/Unit/RowTest.php
index 10d7d7d66e1030bd3cf5f9c4a14d30d342509f12..9a20bda55a28bd573e6d81b6c397395eef90f73b 100644
--- a/core/modules/migrate/tests/src/Unit/RowTest.php
+++ b/core/modules/migrate/tests/src/Unit/RowTest.php
@@ -192,6 +192,39 @@ public function testSourceIdValues() {
     $this->assertSame(['nid' => $this->testValues['nid']], $row->getSourceIdValues());
   }
 
+  /**
+   * Tests the multiple source IDs.
+   */
+  public function testMultipleSourceIdValues() {
+    // Set values in same order as ids.
+    $multi_source_ids = $this->testSourceIds + [
+        'vid' => 'Node revision',
+        'type' => 'Node type',
+        'langcode' => 'Node language',
+      ];
+    $multi_source_ids_values = $this->testValues + [
+        'vid' => 1,
+        'type' => 'page',
+        'langcode' => 'en',
+      ];
+    $row = new Row($multi_source_ids_values, $multi_source_ids);
+    $this->assertSame(array_keys($multi_source_ids), array_keys($row->getSourceIdValues()));
+
+    // Set values in different order.
+    $multi_source_ids = $this->testSourceIds + [
+        'vid' => 'Node revision',
+        'type' => 'Node type',
+        'langcode' => 'Node language',
+      ];
+    $multi_source_ids_values = $this->testValues + [
+        'langcode' => 'en',
+        'type' => 'page',
+        'vid' => 1,
+      ];
+    $row = new Row($multi_source_ids_values, $multi_source_ids);
+    $this->assertSame(array_keys($multi_source_ids), array_keys($row->getSourceIdValues()));
+  }
+
   /**
    * Tests getting the source property.
    *