I wonder: If you press Home on the Roku remote (with the TV off) does that turn the TV on and set it to the Roku input all in one step? It used to work that way for me. (Until I turned off the HDMI-CEC because I didn't like that, but it may work well for you.)
In addition the the above possible workaround, perhaps a different Sony code would work better for you. I'm honestly not sure what kind of code mismatch would consistently provide a power on only on the second time, so I'm just guessing. I'm thinking that some TVs offer discrete on and off codes, and there could be some conflict if the TV sees an HDMI-CEC command and an IR command around the same time, but I can't quite figure it out.
Oh, I assume the remote is aimed at the TV both times, right? I could imagine: you press the power with the remote sitting on the sofa, and nothing happens, so then you pick it up and point it better. Just grasping at straws...
Banned but back. Because why not?