The issue has been happening for a long time, i think almost everytime i start the game. it will force me to alt tab back to desktop for no reason, and randomly. Usually within first 5 min of starting the game, so when doing first few practice laps. Sometimes even within the menu of the game. If I'm in single player, it will pause the game, but in multiplayer i obviously keep going and then crash. After once, it doesn't happen again. I have tried the focus assist solutions already and Do not disturb windows settings as suggested on a google search but it doesnt help at all. I think there was a thread where someone had this problem too in the past. And AMS2 is the only game i have that this issue occurs. I use full screen mode as i feel windowed mode has a slight input delay.
This may be a veeery long shot, but do you by chance use something wireless from Logitech? Then the software for the unifying receiver might be the issue. I had this myself, where it minimized the first full screen game I played after restarting the PC after a few minutes of playing. This solved it for me: Reddit - Dive into anything
Thanks for the suggestion. I dont have wireless from Logitech, but a wireless kb+mouse dongle from Razer. It seems it could be an app opening from that reddit post, but i havent seen anything pop up or open. But i will try looking if its my antivirus or the Razer Synapse app. The solution to rename a file is weird though for the Logitech, so might not be applicable to me. But it still only happens in this game, so maybe there's something there that can be done.