Problem/Motivation
If you are doing a migration and have an error, then it saves an ID mapping without a destination ID.
When you repeat that row, then the destination receives array(0 => NULL) instead of array(). Personally, I think that's a bad API and I'm not sure what the use case is for supporting that as it leads to bugs like this.
The mentioned method does this:
<?php
$old_destination_id_values ? reset($old_destination_id_values) : $this->getEntityId($row);
?>
However, the first part is TRUE, sind the array is not empty, it has a NULL value. That result is that, depending on your migration, it's either silently creating a new entity and ignores the ID you passed in or fails with an error if there is no bundle key in $values.
Seems like a pretty fun way of killing your data, so setting to major.
Proposed resolution
Switch to reset($old_destination_id_values) ?: $this->getEntityId($row)
, so that it falls back to getting the ID from $row.