I've just spent 3 hours with 4 remotes in my hand. It all worked out in the end, posting here just in case someone else finds it useful.
My setup is a 2018 LG OLED65B6, HDMI2 is ancient Yamaha Sound bar, HDMI 4 is 2022 Roku extreme + voice remote, HDMI3 is Tivo.
1) TV kept switching sound bar input when tv was turned on, or when I switched tv inputs. TV is connected to a soundbar from TV to soundbar, via one HDMI cable, and one optical cable.
Solution: LG TV has a somewhat hidden way to configure inputs. It is not in standard settings, but available under "All inputs..." when you are in the input menu. This allowed me to configure my HDMI2 device as a soundbar. Once TV knew I had a soundbar, it stopped switching the inputs.
2) ROKU remote power/volume buttons were not working.
These buttons used to work, but stopped a few weeks ago. The TV's input setup showed Roku as a CEC enabled device. I tried the "pair the remote again", "update ROKU", "update LG", "restart everything", and nothing worked.
Then a weird thing happened. I was trying out the ROKU remote and it did not work. Then I switched my input to Tivo (HDMI3), and suddenly, Roku remote started working. I switched back to Roku, and now Roku remote just works.
My guess is that the problem is my LG TV, there is some weird state it gets into, that makes it not listen to Roku's CEC commands. I wish there was a better way to debug CEC.