If there is no demand then yes, absolutely. It's normal for countries (inc. the US) to run and subsidize their infrastructure at a loss if it is critical to their national security.
The US military has a large pool of mechanics and technicians they constantly train who then go on to private sector. Building things, and building things right, take a level of physical dexterity and mechanical intelligence that must be honed.
Ever see a machinist run a hand over a milled surface, call it out of tolerance by 0.005” and then the calipers confirm? You can’t learn that from a book that shit is straight just 25 years of looking and touching surfaces that smooth. Drilling straight holes into metal frames that bend and give is an art.
You can’t let that die. So the military funds shops everywhere to build widgets for the war machine to keep people employed and those skills alive in the event that when we do need tens of thousands of them at once, there are seasoned veterans ready to lead the way. And in the mean time, they make $150k a year running a small machine shop in Michigan subcontracting for Northrup or Lockheed or something.
Why not do it for just about every critical part of life? Why only do it for the "being ready to kill adversaries" subset?
If you work for the IRS or the USPS, don’t you get guaranteed work, public health insurance and a pension after some number of decades of service?
More broadly I think about all teachers and first responders.
Governments can subsidize their use in local industries or even build the infrastructure themselves doing what many governments already do with power, telecommunications, and transport.
The G7 and G20 aren’t an exclusive club for nothing. There are real things behind GDP.
If that makes goods too expensive for the population (it won't) they couldn't afford them anyways. They were simply paying for the goods by mortgaging their future.