Revert "Merge branch 'revert-80c55f11' into 'master'"
This reverts merge request !43322 (merged)
See https://its.cern.ch/jira/browse/ATLASSIM-5237
It seems this code was not the culprit of the mystery Sim regression. Consequently it can be re-merged (or un-reverted?). Sorry for the faff.