The reason why charities underfund public goods is because of the well-known free-rider problem. It's the same reason why cryptocurrencies need to collect transaction fees and reward miners and cannot rely on charitable miners. https://en.wikipedia.org/wiki/Free-rider_problem
I guess you think all dead men were failures, if survival to present day is your criteria.
The "frees-rider" problem applies to government programs, too. But you're right, we can't just depend on charity. We need for profit enterprise too.