I have no solutions for such historically-deep and culturally-imprinted macro-problems. There is only one "insight" if it even deserves that term, which has occurred to me. None of these problems which reach deeply into the ethnic or cultural divides between people ever really get resolved [and there the "resolution" is often phoney, but at least non-violent] until the common man decides that he personally has too much to lose by making an extreme/violent decision.
This is what some see as a solution but a long, slow one at least in some parts of the world. For the disintegrating Yugoslavia, those peoples' proximity to the European Union and for the most part European culture, made the adaptation to relative peace quicker, even if some there still hate one another's guts. The common man there sees that opportunities exist for his family and himself, if he'll just stop killing the other guy and killing himself, while destroying all of the economic infrastructure around him.
In a way, this is what all "counterterrorism" is. That is an often misunderstood concept, thought by some to mean covert infiltrations and "midnight strikes", but although those things are probably necessary to thwart "underwear bombers", that is another only stopgap measure in the search for a genuinely safe world. Counterterrorism is rather the aid in creation of a true economy for the average citizen to participate in, and there is both pragmatic [how-to-do-this-job] and general education [literacy for all, without which the body politic remains ignorant and can never approach Whiskey's Internet Power democracy booster].which runs alongside the aid to basic economy building.
Some of this was having some success in Afghanistan, mainly riding on the volunteerism of several non-profit charity groups. It is my understanding that the efforts took a backwards step by unintentional [i.e. in good will] involvement by the military, when payments began getting made to everyday folks to attend their programs, thus sucking the populace away from the other programs which were making progress. Everyone had good hearts; improper coordination sunk the ship.
When the common man can see a good future without destruction, it is much harder to recruit him towards destruction. Whatever prejudices he has are submerged beneath his common sense. Even on the Macro-economic scale, places like China [still no great friend] are far away from contemplating war, just the next monster paycheck from the USA consumers. Russia, with its new trade ties to Germany is going exactly the same way, no matter what Putin might still feel that he has to say in public. Morals are what Jesus preached, but this sad old world is still mainly about "following the money", which in the end is why we fight stupid wars in the Middle East.
Helping make life livable at least for the common man in these countries-of-interest [and with glimmers of further opportunities] is the ultimate solution to these horror stories. It is a slow solution, but every positive act towards that makes friends, just as every negative act makes enemies. We need to get to the point where when some insane Kohlberg Type Four fanatic strolls into a village and exhorts the men to drop what they're doing and join the ranks of life-sacrificing "warriors" for some poorly understood cause, the men look at him and say: "You mad, Bro??"
By the way, the grass-Roots work of the Catholic Church has probably been, over the last century or so, the most active "counterterrorist" influence on the planet. Not because that is its intent, but that its message of a Gospel of Peace and Community heals and brightens souls.