The two aren’t always mutually exclusive, you might be writing code for a good market fit that stands the test of time and needs maintaining.
The times you appreciate it are actually when you open something and it’s nice and easy to change and you realise you were the one who wrote it. But real developer happiness comes when you have the same experience and someone else wrote it.