Why did Microsoft created (or branded) WP8 and WinRT separately?

I don't really get why MS created a different OS for tablets and another one for phones that both run on ARM. Apple made iOS that is applicable for iPhone and iPad, Google made Android for their tablets and phones, then why did MS made two different OS?

Please enlighten me and if there's anything that is wrong with the statements above, please also tell me.