It doesn't always work this way, and very much hasn't in the USA. It's been more akin to:
Fear of invasion creates massive military spending
Massive military spending creates a need for justification, and ability to invade
The need for justification, and ability to invade create wars abroad
Wars abroad create enemies and fear of invasion