The reason is that all those other things create actual value, thus cutting into profits of capitalists if publicly funded. If you're a capitalist state that wants to steal massive amounts of wealth from the people and redistribute them to the rich by funding an Industry, then war really is the industry you want because it only destroys value. For example, if you cancelled the Pentagons budget and funded centrally planned healthcare instead, no private healthcare provider could compete. It would completely close down a huge market. Same with education, infrastructure, etc. War doesn't have this problem of closing down a market, but has the advantage of opening up new markets (resources, cheap labour, more consumers, even rebuilding after the war, etc.) via imperialism.
Edit: In short, imperialism is in part a reaction to the tendency of the rate of profit to fall and offers an opportunity to renew primitive accumulation.
Thank you! It's really awesome of you to make all these quality posts all the time and share these cool comics.
My grandfather, a machinist, build their house in his early twenties with his own hands. It was in a kind of cooperative, where you could pay in party by working on building sites to help others build their houses. So, even though he had help from others in the coop, he really effectively build identical houses multiple times. He learned as he went and did everything except electrical work, even the heating and plumbing. My grandparents raised five kids in this house. It really was his proudest accomplishment and near the end, he told the story again and again, almost every time I saw him and I made sure to listen.