The CTO has surely overstepped the boundaries.. the project/company is your baby and no one and i mean NO ONE should tell you to leave your baby.. the CTO is just like a 'hired' babysitter for your baby (you want to ensure that your baby is growing in a good and right direction) and you might lack some parenting skills but that doesnt mean you have to give up your baby in the hands of the babysitter.
Even though you may not be a great coder you can and will grow to be one great coder.
CTO should know this clearly that this company is yours and he is just an hired help.. he may be the best CTO out there in the world.. but he cannot even suggest you to leave the company..