The military tech is actually useful - many of the things we use today as ubiquitous was an artifact of military. It's definitely not the same thing as digging down holes.
However, what i do not know is how much of US military spending is on R&D
Example: GPS was invented by the military. But you could have a different government organization work on all the useful stuff that comes out of the military that has nothing to do with blowing people up.
You could also argue that if you invest trillions of dollars into digging holes, that might result in useful technology. Taking the example of GPS, maybe you need to very accurately know what your position is, so that you can pinpoint exactly where you want the hole to be built.
My hole digging government department could have invented GPS too!
Military needs a way to position vehicles, you get gps, same goed for arpanet. A good chunk of military inventions are done by civilians on military funding.
I think it is the desire in US military to be always on the bleeding edge, and the accountability that it brings. There is also less pressure for profit, I guess.
You said digging holes, elon musk is doing that boring job :)
However, what i do not know is how much of US military spending is on R&D