Companies are, as you say, good at meeting "consumer demand.", but ONLY in the short-term. They are famous for having a 5 year outlook. They don't plan for longer than that because the CEO will be gone by then and won't make any money from profits that come more than 5 years away. Government can, or should be, looking for the long term. The space race is a case in point.
The space race caused us to develop many, many, many spinoff that would NEVER have been considered worth developing by a company. The computer chip itself was developed as a by-product of the space race in order to save weight. Up till that time, although they had developed some multi-component chips, they had vever considered inplementing a computer on a chip. That caused home computers, cell-phones, Home video (As CDs, etc.)
And that's just the computer chips (that consumers never demanded because they didn't know they COULD exist). There are many other spin-offs that were less earth shattering in scope, but important none the less to the US's bottom line.