With both respect and sorrow - you are not going to prevent the next 9/11. It may happen tomorrow, or it may happen in a decade, but it will happen.
Accept that it will. A monolithic command structure can not deal with independent cells. It can respond well, sure, but the problem is seeing what is going to happen before it happens. Not many precogs on the NSA staff.
As far as what to do and who to support - I say do nothing and support no one. Humanitarian aid, sure - go for it, the Marshall plan was a pretty successful idea. But picking sides - just no. I've said it before - ISIL is a proving ground. It is harder training than anything a soldier goes through. Fail, you die, win, you keep breathing. Keeping breathing is a powerful motivator. After 3 years of constant warfare in Syria, they know their business. These are not suicide bombers, these are cold and experienced killers.
You've hit on several good points, EC. (I will only quibble about the humanitarian aid aspect, simply because the US can no longer afford it. It seems that we all have become desensitized (which is a natural phenomenon of the human condition) to the reality of the debt. But that is another topic.)
There are some key aspects of the whole "war on terror" that have been "oversold" (to put in mildly) and have been used to justify the wholesale looting and bankrupting (in more ways than financially) of the nation. One of them is the notion that we must fight ground wars in the ME or NA to prevent terrorism from reaching our shores. Lately I have been wondering when FNC is going to start looping the videos of terrorists jumping over saw horses and climbing makeshift monkey bars that were used shortly after 9/11 to drum up support for the need to eliminate "training camps." I am amazed at the folly of this whole notion. The simple reality of how jihadist attacks may come to the US shores again can not be prevented by blowing up, or commandeering, large tracts of desert or mountains across the globe. The kinds of attacks that they may undertake don't require legions of fighters training with weapons that will be used to invade as a landing force.
All that is required for this type of planning, funding, sourcing, and recruitment is a set of encrypted satellite phones (with an ever changing set of cryptology) and a one-room apartment or hotel room. This type of planning is, and has been, taking place in cities like Berlin, London, Paris, and DC. There certainly doesn't seem to be any shortage of planners, funders, or recruits, it does seem that the sourcing of weapons to inflict the type of mass damage and causalities that they may desire has been the sticking point. Whenever I hear people talk about "terrorists training in Afghanistan for the original 9/11 attack" I shake my head in wonder. It seems pretty clear that those 20 odd jihadists that are generally believed to be the perpetrators of the 4 airplane highjackings did the bulk of their "training" right here in the US. Flight schools from the west coast to the east were apparently used, and much of the clandestine meetings and planning sessions were conducted right here as well, in and around various mosques spread across the country (and perhaps in Berlin). So I simply fail to understand how spending upwards of a trillion dollars, far too many lives of young men and women, not to speak of the tens of thousands that have returned with their lives irrevocably shattered, in order to destroy and rebuild a nation of feudal fiefdoms (living in the 7th century for all intents and purposes) in Afghanistan, has done much of anything to either avenge the 9/11 attacks or prevent subsequent attacks. (I am not even going to get into an Iraq discussion at this point.)
What has happened is that a large portion of the US citizenry has been manipulated by emotions, rather than reason, post-9/11. We've been manipulated into throwing our support into two (still waiting for the third) massive war efforts that simply could not yield anything that they were advertised to do. Instead, they've led to the continuing bankruptcy of the nation's treasury and caused incalculable suffering and pain to far too many families across the nation. We've done all of this, and are our collective appetite for more of the same is being whetting constantly, especially of late. And none of it has done anything of substance to prevent any subsequent attacks for the reasons that you note above. And I haven't even mentioned the cost of our freedom and liberties that have been stripped away (with barely a whimper of protest) in the name of this "war on terror."
Vic's post above alluded to the money trail and who has benefited greatly from all of it, I won't bother to further comment on that, he spelled it out pretty clearly. It is no wonder that the West fails to acknowledge and confront the true source of this terror, because as long as that giant elephant is allowed to stand in the middle of the room, there remains a lot of money to be made (and a lot of power to be consolidated) via the ongoing, long-term destruction of the West. People from all "sides" of the aisle need to wakeup and start thinking with their heads, and not their hearts.