Step 1
Find the line:
https://github.com/magento/magento2/blob/2cacd80/lib/internal/Magento/Framework/Data/Argument/Interpreter/ArrayType.php#L42-L42
Add the following code before:
/** @var int $initialOrdering */
$initialOrdering = 0;
foreach ($items as &$item) {
/** @var array(string => string|int) $item */
$item['initialOrdering'] = $initialOrdering++;
}
Step 2
Find the code:
https://github.com/magento/magento2/blob/2cacd80/lib/internal/Magento/Framework/Data/Argument/Interpreter/ArrayType.php#L70-L73
Add the following code before:
if (!$firstValue && !$secondValue) {
return $firstItem['initialOrdering'] - $secondValue['initialOrdering'];
}
The erroneous core is an usual Magento 2 “friday commit”: Magento 2 team is worried about reporting “my weekly job is done” on Fridays, and commits a lot of bugs every Friday: