Ever stop to think that maybe this is a good thing?
That code doesn't exist to be beautiful -- code exists to get the job done. Beautiful doesn't mean it's not also useless or arbitrary or over-architected, while ugly can be a healthy balance of competing priorities -- maybe not clean, but a good series of necessary real-world compromises.
This isn't to defend all (or even most) ugly code as good... but that equating beauty with good comes across as terribly naive.