Doing The Right Thing (tm) is always easy when looking from the outside in. In my experience, good developers write shitty code all the time, because the world is a messy place and quality comes at a price.
As an anecdote, I once worked on an application where we had to store passwords in plain text, because the password should also be used in a piece of hardware and to provision that hardware, we needed to send the password to said hardware. There's just no good and easy way to solve that and when you're constrained by real world limitations, sometimes you just have to accept a suboptimal solution.