You need to hire an attorney, one who works in business litigation (if you can find someone specializing in minority shareholder disputes, that much the better). Right now. If you're delaying on this point out of some idea of wanting to "try to fix things first" or "not wanting to be the bad guy," you're just shooting yourself in the foot and downing blood thinners to keep the wound from clotting. Working with an att…
I'd go for a shorter version, but: yes, you are right on. Important points: 1. Have legal counsel 2. Deal with the issue now, not later. I'd get a lawyer and fire the CTO. Small teams require absolute trust, and that is now breached. You'll find out in the process how the CEO aligns. Give your partner a heads up, but don't let yourself be moved from the task of firing the CTO.
You're jumping the gun.
First, the way that the OP has framed his story indicates that he's not sure how he wants the situation to be resolved. One of the first questions any good attorney will ask him is "How would you ideally like the situation resolved?" The attorney can suggest possibilities, but unless the OP knows what he wants, an attorney can only be of so much help.
Second, based on what the OP wrote, it appears that he does question his capabilities. He says he's "not the best coder" and refers to technical and project management "problems we were having" that ostensibly developed while he was leading the company's development efforts. This should not be overlooked.
Third, it's important to note that just because you're a co-founder doesn't mean that your employment can't be terminated, and just because your employment is terminated doesn't necessarily mean that you're going to be screwed out of what you have already earned. There's no indication here one way or the other that the OP's departure would involve funny business.
Finally, and most importantly, it's very unlikely that an experienced CTO would ask a co-founder to leave unless he had the support of the other co-founder. At the end of the day, if the OP's co-founder has lost confidence in him and doesn't believe that he can contribute to the company in other ways going forward, the OP has a very big problem that firing the CTO won't solve. The fact that the co-founder apparently hasn't delivered this message directly and tried to come up with an arrangement that allows the OP and the company to part ways cleanly and fairly suggests that the co-founder lacks the character and moral fortitude to lead a company.
The OP should have a conversation with an attorney, but he shouldn't forget about his opportunity cost. If you discover that you're not dealing with strong, ethical people, sometimes cutting your losses is the best approach. That can be hard to do, and it's not without risk, but people incapable of dealing honestly with their partners and employees, especially in difficult situations, don't usually have what it takes to build successful businesses anyway.