Yeah, think of it like a corporation. Instead of shares, you have votes and taxes.
Everyone in the military can vote on the actions of that military. Although, so can everyone not in the military. And the number of votes don't correspond to how many shares you can buy, because it's more equal than capitalism.
Americans vote for representatives who determine when and where the military gets involved. But even if it had been subject to a direct vote, the outcome would be the same.