Indeed. The primary cause behind "militarism promotes science and technological advancement", is because inordinate quantities of financial and temporal resources get allocated to feeling secure and dominant by small groups in our species, to "defend" against the others. The science fallout is just a thin, sticky residue left behind.
If even HALF the resources allocated to the dick-waving and security theater were simply allocated directly to science endowment funds and to primary, non-commercial research, the degree of scientific discovery we currently enjoy would appear miniscule.
For an example of this, look at what the internet currently is, in terms of services and products available, compared to what it was 10 years ago. It's current "highly comercialized state" is the result of the decision to allow corporate involvement and sponsorship in its operation and evolution. The result was "eternal september", and runaway commercial exploitation of user data.
If it were instead funded as a noncommercial project, with the same allocation of funds and resources, the internet would be a much more varied and vibrant place than it currently is, more focused toward communication and learning than toward selling herbal viagra and breast enhancement pills.
Space exploration is the new opportunity to shine. I groan about commercialism in space flight, as it is part 2 of the "comercialism screws everything up!" Experience. However, since our word cultures appear completely impervious to having reason or learning from mistakes drummed into their heads, no matter how many hard knocks they receive, it is the lesser of the two evils. (Would rather see a giant billboard on the moon than a doomsday nuclear launch platform.)
The *BEST* solution is for pure science, free from commercial fuckery or military dickery, to be the driving force of space exploration-- however, that seems to go against prevailing human nature, all the more to our deficit.
Sadly, people (and groups of people) only seem to want to invest time or resources into something they see as being able to give direct and immediate benefits for the expense. Abstract benefits like knowledge and experience are not given the gravity they rightly deserve. It's why we always make the same fucking mistakes over and over and over again as a species, and seem hell bent on refusing to learn from them.