Another Area of TD
One area of TD that is overlooked is when the requirements change significantly but some of the old code is still needed. You might really need to rewrite the code completely.
Another area of TD is when the system does not allow the easy solution and any working solution is nasty kludge at best.
Not all TD is due to poor programming or shaky specs.