The system can have multiple user accounts, each of which can have their own userland settings. Which user's settings the initial login screen should use?
The only answer that is fair to every user is to use the system-wide default settings in the initial login screen.
But the "session is locked" screen is technically part of the session of the logged-in user. Behind the lock screen, that user might have some unsaved work, or just a complex set-up of multiple open applications and documents needed for their task. With a locked session, the user that owns that session is in a preferred position: the default assumption is that they're going to come back, unlock the session and continue using it. So, it is fair to use the keyboard layout selected by that user, since that's probably the one they're the most familiar with.
If the lock screen includes a "switch users" functionality, then the problem becomes more complex. In this case, the optimal behavior that is fair to all users would be to switch to the system default layout as soon as that functionality is selected, and not before that.
On the other hand, the lock screen is a security-sensitive function, and adding the complexity of keyboard layout switching to it increases the risk of bugs that might be exploitable as security weaknesses, so it might be an acceptable trade-off to omit the keyboard layout switching functionality from the lock screen. If the new user can successfully authenticate, their new session should automatically configure their preferred settings anyway.
If you are the only real user of the computer, you might want to set the system-wide defaults to match your personal preferences. On a multi-user system, the system administrator should choose default settings that are at least tolerable to every user - if the defaults are actually good for the majority of users, all the better.