> It's the question of why so many open source tools get built by startup teams in the first place
The capitalist answer would be that markets are more efficient than governments at capital allocation and thus private companies are better positioned to develop software that solves real-world-problems, and in this case are so much more efficient at it that the stuff those companies give away for free as open source still dwarves publicly funded efforts.
My own opinion is that there are plenty of software problems worth solving that don't fit neatly into that bucket and you're likely right that some increased degree of public funding around them is worthwhile. In the US that tends to end up flowing through the university systems. I mean, the internet itself was DoD funding going to university labs.