Being a CTO myself and having worked with smart people that were not as good coders, I think that in your case, the new CTO is just looking for a bad excuse to kick you out. Kicking out somebody who knows the system, product, infrastructure or code base from the beginning is generally a bad idea. Also, the line of professionalism between somebody like you (producing unstructured code without tests etc.) and genious like him is thinner than you think. He's either very arrogant or up to something. In any case, he definitely stepped over the line.