Sadly that's only accurate if you're not massacring the locals using said troops. Ergo, it doesn't work for the US, but is working for China, Sudan, Saudi Arabia, Iran, ...

I would argue that you're entire premise is wrong. You assume only the US is doing the killing here. That these terror organisations are just the friends of the locals. In reality, terror has 2 legs, one of which the US supports and the other the US bombs. That won't work, and everybody realizes that. That's not what they're doing. Locals, especially mothers, are perfectly aware of what these terror organisations are trying to do and would like nothing better than keeping their kids and husbands away from them. Yet that's not happening. Why not ? Well ...

Terror organisations, like Hamas, ISIS, ..., mainly do "social" work. Unemployment benefits, scholarships, marriage subsidies (and arranging marriages in the first place, in islamic societies there's a huge need for this for obvious reasons), jobs, resolving conflicts, policing, food aid, child subsidies, ... They use the power they get through this to commit acts of terror, massacres and, if possible, invasions. In the case of Hamas, it's social work is subsidized by the UN, paid for mostly by the US (because most UN member states don't actually pay their dues).

Needless to say, these organisations need to be replaced. But they make it impossible to get to the local population, to offer them an alternative. You want an education and had the bad luck to be born in Gaza, Hamas can give it to you, no one else can. Needless to say, it comes with conditions. Getting married is the condition if you're lucky, getting a family member to ... if you're not. They are like the mafia, and will bomb anyone who tries to help locals outside of their system (they have bombed UN kindergartens, for instance).

In this way, the current islamic terror organisations are not all that different from their Soviet equivalents of 3-4 decades back. There is one company in Gaza : Hamas. There is one hospital in Gaza : Hamas. There is only one landlord in Gaza : Hamas (and nobody owns an apartment aside from Hamas leadership). There is one school in Gaza : Hamas. There is one university in Gaza : Hamas. There is one marriage organizer in Gaza : Hamas. There is one supermarket in Gaza : Hamas ... I don't know, but I imagine the situation is similar in Iraq and other places. They are mafias that are a state, effectively.

This is why the problem is so hard. You have to kill these organisations, prevent their functioning, and then offer an alternative to locals. This is what they're trying to do : kill off the top of these organisations. Give their lieutenants and middle management the chance to run away with the school money of half of Gaza, to give the UN a chance to open a fair school system without those conditions (for example).

More generally what needs to be done is to give the local population a real alternative for a life ("a career", plus a few things) other than the local terror organisation. If you have better options available, I am positive everybody is itching to hear them. Today we are seeing that these organisations are moving into and establishing colonies in large European cities (though at the moment their "net" is very leaky, but still tight enough to make them grow anyway). Literally everybody wants to hear your solution for this. From the US, Western European states, China, to the Pakistani state and everybody in between. Please, please give them another solution, because, frankly, there are places, outside of the middle east, where this war is not going very well at all.