Have you thought about taking on the role of CTO?
Not sure if it's a possibility or something you even want, but it sounds like you're invested and have thoughts around the role.
Maybe if it comes to quitting..before you do that have a conversation with the CEO about taking on the role?