As always, the correct answer is "it depends".
A program not requiring user interface interaction will always work - and allow remote interaction - no matter if the screen is locked or not. Network communication is not interrupted because you lock the screen.
But tools that directly interface with the UI are impacted by screen lock, and again, "it depends":
If teamviewer is installed on the host level (only possible with admin permissions), remote control works even after locking the screen. Since the remote user would only see the windows login screen he/she would need to enter your credentials to unlock the session before being able to do anything of value.
When teamviewer is run in the user session (e.g. quick support) it will only work until you lock the screen. Then the user interface is disabled and remote interaction is not possible anymore.
For both cases you can see that screen lock is a good security measure, that's why most companies automate it e.g. after 15 minutes.
Assuming your user session did not have admin rights: locking your screen would definitvely have prevented the teamviewer-browser-paypal scenario. It would not have prevented other kinds of issues like data exfiltration, etc.