We could have nipped much of this in the bud early if we would have understood the problem from beginning in terms of fundamental human nature and governance.

AQ had and has a three point platform, paraphrased free of Islamist jargon it is:
Too much Western influence over the Middle East;
Too many existing regimes are too in bed with and corrupted by that Western Influence;
Need to rally together and form a unified system similar to the EU or ASEAN if we are to compete.

What part of that is counter to US interests??? We should have co-opted the heart of this message immediately, leaving bin Laden with nothing left but a bag full of crazy and a handful of followers.

We blew it. It is not too late, but we continue to blow it when we say we want to defeat ISIL and restore Iraq as it was. Be against ISIL, but we must outcompete organizations like ISIL as a source of support for a Sunni Arab population that has very reasonable concerns about remaining under Shia dominated governance.

As to Europe, they need to clean up their own act. Europe is changing, but when minorities perceive themselves to be treated unfairly they will act out. That is how they feel, and that is how they are acting. The problem is not that they went to Iraq in support of the Sunni cause, the problem is that when they return home things are still F'd up.

Governments do not need to give people what they want, they need to work to give people what they need. This includes the US that has slid into a mindset of excessive government programs that simply give things to people. You can't bribe your way out of trouble, which the Saudis will probably learn soon enough. Small changes that go to justice, dignity, popular legitimacy, empowerment, and popular sovereignty are the key.

A couple of small tweaks of policy along those lines and the US would be Canada. If the King would have been a true visionary and moved the capital from London to New York Britain would still rule the world. But that is another thread altogether...don't want to get David too excited.