And it's moot for both these cases because the technology was needed for direct military applications anyway.
What's the practical or ideological benefit of industry-industry R&D when the military is going to be the only customer, or at least the only paying customer for the first years/decades of use?
I agree with you in general, with it being better for governments not picking the winners of markets or deciding who gets research money.
But military is such a unique (yet universally needed) type of market, that practicality here means treating them as a large customer with unique product needs ( products unlikely to be revenue generating on the public market), even if you don't treat it as direct government allocation or a fixed/manipulated market.
The only way I can think of to avoid that entirely would be some libertarian version of an all private, defense-by-contract type military.
And then you'd have concerns about whether that could hold up to peer adversaries, and dozens of other wildcard concerns.