My solution to that problem was to switch fields. Now I have a rather comfortable job and plenty of free time. I get to work on whatever I want and only if I feel like it.
Some days I wonder what it would have been like if I had chosen to program professionally. I try to maintain my skills just in case.
That's easier said than done. I'm a data scientist/ML engineer rather than a software dev, but I don't think I have any skills that would give me remotely similar pay in any other field. At least not without going back to school. I could teach math or CS as an adjunct I guess? Build and sell computers? Enact crypto scams? Maybe I lack imagination ...
Some days I wonder what it would have been like if I had chosen to program professionally. I try to maintain my skills just in case.