True that it could be factored, to make less code but also to make UI more uniform.
Seeing User prompt on lock screen, I guess it could be done with replacing the process which is part of the user session with sth similar to “Switch user”.
I guess it would be easier when login screen will be able to remember the last user used, so this part will be “ready to use”.
BTW, are there tags for lock / login screens ?