I'm not sure how military spending props up STEM exactly, but I do often hear people say that military spending is good for science because so many research advances have come from the military.
But if you look at how much the US spends on military versus the scientific progress coming from the military (e.g. DARPA stuff), the yield is actually surprisingly low. At the very least we can probably agree that it's not a very efficient way to fund research.