but I seem to remember that we frown upon some country fighting some other country over that other country's territory, unless there's been an attack in the opposite direction beforehand.
Well, the situation is more complicated than what you're suggesting. In a nutshell, here's the sequence of events that led Turkey to this point:
I urge you to do your own research (don't even accept my comment as it is) before making any definitive statement about the socio-political and militarian status in the middle-east. The majority of media consumers seem to shape their opinions based on click-baity titles and non-reliable sources of information that tells the story only from one side. I'm not saying you're one of those people, I'm just saying, please don't be one.
"Help Mr. Wizard!" -- Tennessee Tuxedo