Any form of maintenance or cleanliness is basically bistable.
Start off with things clean, consistently try to keep it that way, and it's actually pretty easy and not too much effort.
Start off with a mess, or start off clean but then neglect things for a while, and you will wind up at the bottom of a hole that it is going to be a long, painful slog to dig yourself out of.
This applies to tons of things: coding, keeping your bathroom clean, car and home maintenance, personal relationships, financial management and record-keeping, etc.
Unit tests also force code to be written in a way it can be refactored and is abstracted at a (somewhat) reasonable level. Its very hard to get test coverage on a 2000 line mega-function.
Fixing bad code is like repairing an old building, you have to put in the scaffolding and supports (int/component tests) first to make sure it stays up before you gut it and check whats salvageable (refactoring and unit tests)