Apple has made many security improvements in macOS during the past few years. This means that sometimes when you connect to a remote Mac, the login window appears even though you've already log in via Screens:
Apple added this feature for improved security when remotely controlling a computer in an environment where you don't want the computer to remain unlocked when you are done screen sharing.
If you want to disable this functionality, you can open Terminal on your remote Mac and type:
sudo defaults write /Library/Preferences/com.apple.RemoteManagement.plist RestoreMachineState -bool no
Use yes instead of no to restore the functionality.
We do not recommend to turn this functionality off unless you are certain that no one else will be able to access your Mac physically when you are away.
One-Step User Password
We understand how frustrating this can become, especially when you have a long and complex Mac user password. This is why we developed a feature called "One-Step User Password", which is available on iOS and Mac (on which the feature is called One-Click User Password". You'll find more information about this feature here.