Directory.CreateDirectory does that already:
Creates all the directories in a specified path.
For your question
If it is "Temp/Temp1/Temp2" is created and another program delete Temp1 directory before creating Temp2 so the exception is thrown?
I think it's quite unlikely. Why should another program delete a directory that doesn't even exist yet?
The method may throw many exception, one of them probably in this unlucky case. You can try to implement that: create a thread that permanently deletes the directory in an endless loop, then create another thread which creates the directory.
is it create one by one internally?
Even if it might be possible to answer this question, you should neither care nor rely on that implementation. Microsoft could change it with any update of the .NET framework. It could also depend on the file system. Perhaps they use TxF (file system transactions) if the file system supports it, like NTFS, but they can't for FAT32.
On Windows, they simply call the CreateDirectory Windows API (line 329 in the source code) but they could also switch to CreateDirectoryTransacted Window API