I have tried your exact example and, yes, it works.
It sets the doctype and when switching to code-view the doctype i at the beginning of the page. When i switch back it still is there and everything works fine. But when not editing the complete document your editor removes the doctype when switching back to the Normal-view. This has to be a bug.
But when i set the contents of the editor programatically in my projets it does not matter if i edit the complete document or not, it removes the doctype as i switch back to the Normal-view.
I have tried to set the doctype over and over again both in the code behind and the aspx-page, nothing seems to work. Can you please give me an example on this when you populate the editor in the code behind, preferably in VB.NET?