I agree with this point. The CEO does just what he was told to. I assume he's just an employee without ownership, and employees don't fire owners unless someone much stronger is behind them.
Definitely lawyer up, that would be a first thing. Then, if you want to regain control about he company, consider CEO your enemy, not the CTO. Invent a reason and fire the CTO, if you can do it. Then, step up as CTO yourself, or at least hire a person you trust. Then, hire COO, CFO, CMO. Make sure those are people that are loyal to you and where each one will take over one of the CEO responsibilities. At the latest stage, let those people document every mistake of CEO, and you try to push him out together with C team and investors.
That's exactly what he is doing to you. He convinced you to voluntarily step out from CTO position and hired his tool. Now, your chances to fight back are much worse from this position, but the war is not yet over.
So, lawyer up, read Machiavelli, know your enemy and fight fire with fire. Remember, the CEO that did this to you is not your friend anymore, and deserves whatever you do to him.