For me, the issue only happened when I used light.turn_off with a transition time. If I leave the transition time unset, it works fine. I was fine with the default transition time in my automations, so I just removed the transition time and it worked well enough for my purposes. (It looks like I said the opposite in my original comment above. It’s definitely leaving the transition time unset that works for me.)
FWIW, here’s the thread about my issue: Issue with HA automation resetting Blue Dim Level