Castro wanted to kill Kennedy, so he could then deal with LBJ, because...?
I do not believe that Castro wanted to kill JFK if he could be legitimately blamed for it. But I do believe that he wouldn’t have objected to, or try to stop LHO from killing JFK (provided no blame would be conclusively pointed at Cuba).
According to Brian Latell, Castro knew that the Kennedy brothers were trying to assassinate him, then overthrow the communist government, through the CIA covert activity.
I believe that Castro probably thought if JFK was killed, and blame directed elsewhere, that LBJ most likely wouldn’t continue to pursue the assassination attempts on Castro.
Alexander Haig wrote that Johnson “believed until the day he died that Fidel Castro was behind the assassination.” Maybe LBJ decided he didn’t want to have a similar fate if he could avoid it...