The problem with these big IT companies like in Microsofts case, is the brains that made Windows, Office, SQL Server etc have long since gone, you have newbies looking after the code.
This is true.
This is what you get when accountants run a company to maximse profits...
Well, yes, probably ... but in the case of Windows it's because the system has been around for so long that most of the people who worked on it in the early days have retired or even died.
Dave Cutler (wikipedia link) is 74. He still has a position at Microsoft but I doubt it is full-time, and I doubt he does much maintenance work on the NT codebase any more!
It's inevitable that there will come a time when any mature codebase will have to be maintained by people other than the original design team, who may not be fully in-tune with the design methods and goals of that original team. There may or may not be documentation to help them, they may or may not read it if there is, and it may or may not actually help if they do (yes, I've worked on software projects in the real world).
Even without that problem, code gathers cruft. Bug fixes and added features change the structure of the original code, which may or may not have been clean to begin with. Maintenance gets harder, not easier, as time goes on, bugs slip in unnoticed, and quality falls further.
Meanwhile, advances occur in our understanding of the software process. New tools and languages are developed that make it easier to develop software that is robust, efficient and safe. There comes a time to throw out the bathwater and the bath (the baby has long-since grown up) and start again.
Conventional wisdom tells us that rewriting an existing product never pays, but this view overlooks the high interest rate on technical debt. If you can't let go of a dying codebase you'll lose market share to a competitor whose code is cheaper to maintain (for whatever reason).
Forgive the desultory rambling ... it must be Thursday ... I never could get the hang of Thursdays.