Bad smells

As developers, we all do it. We're not proud of it but we do it anyways. I'm talking about writing bad code. Often times, we even know the code is bad while we are writing it. So why do we accept our own subpar code?  Let's assume that our skills are such that we could improve the code...after all, that is one of the reasons we feel it is bad code to begin with? So I reiterate, why do we accept it?  We usually try to justify it by telling ourselves that we will come and clean it up with the next iteration. The sad reality is that doesn't always happen.  I think its a cultural thing. We are too often focused on just getting the code out so we can move onto the next thing.
I think the solution calls for a cultural shift to focus more on quality and maintainability.  In the short term, it will appear that we are less productive. In the long run,  however, the code will be more robust, scalable, and maintainable which ultimately provides the most value to the company.