I thought I would chime in here, I seem to be having a similar issue. I have a 2016 Sony android TV, a Roku Ultra 4802, a Shield TV Pro (2019), and an Apple TV 4K (2022).
My sound bar is a Vizio M Series that supports Atmos and DTS:x, and I've started to encounter the issue more randomly since I've turned CEC back on, on the TV, and have been using the Roku more.
What happens for me, is when everything is working as it should:
the sound bar turns off and on with the TV, and the TV switches to external speakers.
When the problem happens, the TV seems to forget the CEC connection between the TV and sound bar, and switches back to TV speakers. The sound bar also doesn't turn on with the TV, as others mentioned I can manually turn on the sound bar, and it works, but the TV speakers stay active, so I get sound from both. Unlike the other case here, I can pull the power from the sound bar, and plug it back in and things are normal again. This random behavior seems to have started more with CEC being on, and the Roku being present. For a while I was using the TV with Bravia Sync off, but wanted ARC because I ran out of direct HDMI connections in my switch connected to the sound Bar's HDMI in port.
One of the other factors in my case was, that I had too many CEC devices for a while, so it was violating the specs. I've fixed that by either disconnecting devices I don't use, or disabling CEC on those that I don't need it on. This has mainly fixed it, however whenever the ROKU is in use / connected, I still get the random issue. My Roku 4802 is up to date with 12.5.0 build 4178. Also to note, I turned off 1-touch play on the Roku, but that doesn't disable the power CEC commands, and I think that's what causes it. I have the Roku TV control to use IR and not CEC, however, I've noticed that Roku's CEC functions are poorly implemented and it just has to be there to cause random problems.
There also doesn't seem to be a secret menu to kill CEC completely from the Roku which would be nice if there was. Since there is no set pattern in when this happens for me, the only way I could completely be sure the Roku is causing the random issues is to completely disconnect it for a while, and not use it. Which I could do, i've considered dropping Roku with the random issues I keep having but things were starting to be fixed that I was having issues with, and as far as a streamer as far as watching content, that's working fine. Now it's just the CEC related issues.