No economy of scale. The cost to build one car is ~$100 million. The cost to build the second one is ~$20K. The only reason you can buy a car for $40K is because they build millions of them to spread the initial investment. The military buys missiles in units of 100s and there are no other buyers, so the cost per missile is massive.
Those contracts are put out for competitive bids. Profit margins for defense contractors aren't very high. The prices are driven by a combination of strict requirements, lack of economies of scale, and legal compliance with government mandated processes.
Consolidation of defense prime contractors was inevitable due to budgetary realities and the escalating complexity of major programs. It's unlikely that keeping a bunch of small, weak companies around would have produced better results for the military or taxpayers.
Why do you think that’s the reason for these high prices rather than, say, lack of competition?