Indeed this is a very curious case... I've been trying to figure out scenarios where it's possible for the system to use a change address that isn't generated by the wallet... the options I have are:
1. The backup is using a different seed to the original wallet. I believe it is still true that the seed will still be changed when you enable encryption on the wallet... but that it doesn't if you simply change the passphrase.
How old was the backup wallet.dat file that you used? When did you create the backup? Did you encrypt the wallet AFTER you created the backups?
2. A "custom" change address was used.
For this, "coin control" functionality needs to be switched on in the settings, and a custom change address needs to be entered into the appropriate textbox on the "send" tab.
3. There is some, as yet reported, bug in Bitcoin Core that is causing it to generate and/or use incorrect change addresses.
I created the backup wallet.dat this week and generated the wallets on an air gapped system in bitcoin-cli using the command: getnewaddress. For the record, I've run all commands on this original machine.
Then I shutdown bitcoind and after copied the wallet.dat file onto my USB.
The wallet was never encrypted in bitcoin-cli as I stored the files in an encrypted "file" partition on the drive.
"Coin control" is disabled. I did not specify a change address when sending the $10.
Air gapped system generated the wallet. -> Transferred onto encrypted "file" partition (on usb). -> Backed up the encrypted partition.
Later, on the second, online pc...
Copied encrypted partition from usb. -> Decrypt. -> Copy wallet.dat into its directory. -> Ran "bitcoin-qt.exe -rescan", waited -> Sent $10 to friend.
At that moment would the change address in theory still be pre-determined from wallet.dat or did it generate based off the seed of the second computer?
Yes I have that key.