Now, it may very well be true that many people who use
GetForegroundWindow() as the owner for a dialog box because they don't know any better, but I'm not convinced that everyone who does so did it out of ignorance; I'm sure there's some malice in there, too. Here's how it may have gone down:
Bug: I start the product setup, and then I go and work on something else, and then setup hits a problem, but the error message can't be seen because it's hidden behind another window.
Result: Setup fails to complete.
Expected: Error dialog is visible so user can address the problem and allow setup to complete.
The programmer who is told to fix the bug, of course, tries to figure out how to fix the bug, and since the bug report said that the error dialog needs to be visible even when other programs are running, the programmer gives a shrug and does what the bug report says should happen.
And that's how the installation program ends up disabling Task Manager.
(Commenter Jamie has another very plausible scenario.)