My theory is that the encryption key that is used for your iCloud data is derived from or encrypted using the password or passcode, and that when you set up a new device it will ask you for that information.
This is all conjecture, but I bet it starts with the password/passcode to the FIRST device you use iCloud with. Then as you add more devices, the passcode/passwords on those are also used to encrypt the iCloud data encryption key, so now those passcodes or passwords can be used as well to set up new devices.
So to access iCloud data, you need two things:
- Authentication to obtain access to the encrypted data (logging in with your Apple ID and doing 2FA)
- Encryption key (to decrypt the data once you have access to it)
Again, I have NO idea how iCloud encryption and security actually work. This is just a theory based on behavior I've observed. In my case I was asked for the passcode of my iPhone when setting up iCloud on a new Mac. Maybe it asks for the passcode/password on the other device you most recently used. I haven't set up enough devices yet to find a pattern.