There’s a completely free app (no ads, either) that prevents auto-rotate from actually happening unless you want it to. It pops up an icon when your phone wants to rotate, and it you don’t tap it within the timeout (adjustable up to 3 seconds) then the icon goes away and the rotation never happens. It’s highly customizable, and I just can’t live without it since I found it.
As a backup option, you can give Google Assistant or a Google Home the following commands: “at 10PM, sleep {lightname}” to dim, or “at 6AM, wake {lightname}” to brighten - both work over the space of a half-hour, and for some odd reason that’s not customizable.