A remarkably large number of the most notable of those people came from wealthy families - that’s what allowed them the single-minded focus, instead of worrying about food and healthcare.
And a lot of them suffered in poverty to pursue what they loved. Is there survivorship bias there? Sure. You don't become great without taking some chances though.
If we want to equate them then we should aspire to write code that is meaningless while we are alive, while living our entire lives poorly or being completely ostracized in society?
I'm not sure the startup angle jives with the artist's.
Most of the code I've written in my life has been meaningless,
but yes I get paid well. The ostracisation happened to a lot of devs during high school through the invention of the wedgee.
I am a scientist and thousands of scientists and engineers use my work.
Most great artists, musicians, writers, theorists, scientists, teachers, and inventors would not need to struggle as much if they would have some money to cover their basic needs. They would just avoid bullshit gigs and do they stuff with a greater focus. And if having $1M in their bank account would stop them doing what they love, then it is quite possible that they didn't love it in the first place.
Artistic pieces or songs are generally a representation of an event, a struggle, or a state of mind - if you lead a cushy life then no, you're not going to have the same output than if you were living on the breadline. There's a reason that history is dotted with songs and pieces of art that were written during times of struggle.