To prevent Windows 11 or 10 from locking itself, first disable Dynamic Lock and the "On Resume, Display Logon Screen" option in screensaver settings. Then, on Windows 11, head into Settings > Accounts ...
There is some dynamic feature for that, I think. If it didn't really go to sleep mode then it won't make you login again unless the dynamic lock feature is triggered. The screensaver settings are kind ...