I think your correct but backwards
The CIA wanted it done and enlisted the mob help.
I wonder what they had on Jack Ruby to make him do what he did
I was under the same impression as you for many years. But there was too much mob involvement continually surfacing for me to continue to believe that. See “The Ultmate Sacrifice” by Lamar Waldrum for a compelling argument.
Now it is true that Hoover had many reports about the plot from his Mob informants and did nothing and it may be likely that the Agency did too. But I think the plot between Carlos Marcello, Santos Traficante and Sam Giancanna proceeded with the expectation that their working with the CIA against Castro provided them with the means to cover their action. As to Ruby, recall that he wanted Warren to take him to Washington where he would be safe to tell all.
His real name was Jack Rubenstein and he was in the Jewish Mafia, like Meyer Lansky.