The problem is a two sided sword. MS could easily write up a new OS from scratch (like Apple did). That would however mean losing some if not all backwards compatibility (like Apple did). Windows versions piggy-back code that's in some cases from the DOS ages all to maintain backwards compatibility. This method of working also introduces vulnerabilities in the old code which have not been found. IIRC It's not that long ago that a 16 year old bug was exploited and it still worked in Win7
Actually, they cannot write an operating system from scratch. They have never had to do that. Even DOS was not written from the ground up. They started with a lot of code from others work.
They do not have the talent, nor the management skills to do it anymore. It would take a huge shakeup in the infrastructure, of the corporation, to be able to even think about starting from scratch.
Yes, any number of vulnerabilities have been caused by trying to maintain backward compatibility.
If they were to start over today, they would probably start with Linux and bastardize it.