USA military presence in foreign countries creates terrorism; it doesn’t stop it from emerging.
Foreign countries wanting to use the USA military in place of financing their own military are motivated to create terrorism where none existed so as to qualify for this benefit.
The main qualification when terrorism arises is for the host country to allow the USA to fight the terrorism that emerges on the host country’s soil. That along with a commitment by the host country to renounce, denounce and otherwise assist the USA in its efforts to stamp out the disease seals the deal, saving the host country from the high costs of maintaining an effective military.