I’ve had this happen too and yeah, it’s super frustrating. My iPhone stays connected, but after a while the internet just stops working on the PC. I’ve tested a bunch of stuff and here’s what helped a bit:
Go to Device Manager on your PC, find the iPhone under Network Adapters, then open Properties. Uncheck the option that lets Windows turn it off to save power.
Do the same under USB settings for anything that says USB Root Hub.
Make sure Low Power Mode is off on your iPhone.
Try keeping the Personal Hotspot screen open for a bit before you lock the phone.
Also, turn off Metered Connection in your Windows network settings.
iPhones are just kind of picky with Windows when it comes to tethering. Android seems to be smoother in this setup. You’re definitely not the only one dealing with this, so hopefully this makes it a little better.