Moved misplaced transaction.atomic from 0dce44e16b

Thanks Florian Apolloner for noticing the issue and Aymeric
Augustin for the expertise.
Refs #22540.