Code that was well-engineered 3 months ago may suddenly become lacking in light of a client having a brilliant new idea/requirement.
And a programmer is not always in charge of his estimates. He may have to arrive at it together with his team lead who is under pressure from 2-3 project managers, thus only the minimal reasonable time will be allocated, without concern for architecture changes or refactoring.
Yeah, but in my experience, the PM's response to that will be "can we get it done sooner?"
If the estimated time aligns with what they want, then you're fine. But that's rarely the case and when things slip the code cleanup is pushed to the back burner.