Working as intended. Military expenditure is good for the military-industrial economy and is easier if you have an "enemy" to engage with.
It also conveniently turns anyone who doesn't want their community to be looted by oil companies and mining companies into an insurgent to be targeted.