When the transfer of the data was complete, my photos were all jumbled up.
Where are the photos jumbled up? In the "All Photos" album? This album is not very stable. It is usually sorted by the date you added a photo to your Photos Library. And the most recent photos will appear at the bottom of the album. But when you restore an iPhone from a backup or after a system upgrade the order of the All Photos album may change, because restoring them can add them in a new order.
To view your Photos sorted by date, browse them in the "Photos" tab, in the Moments or Collections. This view is always sorted by the capture date of the photo.
(from the iPhone User Guide: https://help.apple.com/iphone/12/#/iph4b10d4c2bhttps://help.apple.com/iphone/12/#/iph4b10d4c2b)