Two raspberries on one TV, CEC only works with one of them

Two raspberries should run without a problem connected to one TV. I have RPi 1 model B connected to one hdmi port and RPi 2 connected to other hdmi port. It works fine regarding switching CEC context from one pi to the other.

It is probably your TV to blame here. Maybe you should try to upgrade its firmware.

I don’t know what OS are you using, but when I use OSMC I have big problems with CEC, that I described here:
osmc-alpha-1-4-rpi-cec-issue

CEC issues are probably very TV vendor dependent, I have Sharp.