It didn't take 9 years though - as far as we know the original TF2 was put on ice to focus on releasing Half-Life 2, and work didn't begin proper until that game was released, at which point they scrapped what they had in the first place.
Curiously, the development of DNF is very similar... switching engines, scrapping previous work several times, eventually releasing screenshots and gameplay videos. We don't know how much other Valve projects delayed the production of TF2, but we also don't know how much other 3D Realms projects (e.g. Prey) delayed DNF. The big difference is TF2 released while DNF did not.