"I just read this and think, why do we have so many military bases in other people’s backyards?"
Is this a 'rhetorical' thought question, or are you serious?
Assuming you're serious, the answer is, whether we like it or not, it goes with being the world's police force. A job, btw, which we are horrendous at. At least since January 20, 2021.
Typically these bases are approved (and usually welcomed, I believe) by the host country. With Iraq, they probably have no choice but to let us keep whatever military force there that we want. I don't know if that's the case with Syria, as the world seems to be treating it the way a cat treats a litter box.