Terminal opened from Terminal opened from Files fails to find user settings

I've managed to fix this, but I have no idea what happened.

Fix

Go into the Terminal window hamburger menu > ‘Preferences’ > ‘⟨profile name⟩’ sidebar item > ‘Command’ tab and check ‘Run command as a login shell’. I've left all other settings as I found them:

enter image description here

Re: @steeldriver's comment below, if I leave this option unchecked it is unchecked in all Terminal windows, both the ones that work and the ones that don't. So presumably checking the option has no effect on the originally-working windows, and only comes into play in the fourth, originally-broken scenario.

Explanation

I'll leave this for a little bit before accepting it as the answer in case anybody can provide a more detailed explanation of what happened.