Yeah, I'm pretty sure it's because the "lock screen" is just another process running on top of the desktop capturing all input and for whatever reason sometimes it takes longer than normal to start. But if that's the case, then the design is fundamentally wrong - it should be written in such a way that the desktop cannot display at all unless the state changes to "unlocked" somewhere deeper in the system.