Another gift from iOS 13. Began with the release of 13.0, not a beta. I have the 3rd gen 12” iPad Pro and occasionally while just looking at the screen it would rotate 180 degrees. I haven’t had that happen for a while now. But I’m on the current 13.2 beta so that might have fixed it. My wife’s first gen 12” iPad Pro on the current general release does it all the time.
It was happening to my iPad pro 10.5' randomly in the past like you wrote, opening the iPad, but then it was fixing itself . After iPadoS 13/13.1/13.2 "no beta" it's happening all the time!!
If I rotate the iPad in Mail , it stays vertical till I don't close the app and reopen it ?