"code that makes money is predominantly not fun to write"
I disagree, I've had a lot of fun writing code that makes money.
I've:
1. Built AI, before the current AI hype - it made money, paid my salary and was a lot of fun.
2. Built low-latency financial software - it made money, paid my salary and I had fun optimising for low-latency and learning about finance.
3. Built software that controls real-world devices, in this case a whole railway. Seeing your software control something in the physical world is a lot of fun.
Sure I've also written some very boring code professionally, but it's not all boring and it doesn't have to be.