IMHO...
Our going into Afghanistan was 'righteous', but we should have been in-and-out of there within six months, and not tried nation-building.
Our going into Iraq was 'unnecessary', but we should have been in-and-out of there within six months, once we killed Saddam and his sons, and not tried nation-building.
In the final analysis, ISIS is a product of the Arab Spring, not American intervention in the region.
American intervention in the region merely accelerated its solidification and accelerated its ability to gain traction.
The Arab Spring infected Tunisia, Libya, Egypt, Yemen, Bahrain, and Syria, among others, with special emphasis on both Egypt and Syria.
The Arabs of the region were already well along the road to throwing off Western influence and returning to a fundamentalist flavor of populism.
Our misguided intervention in Iraq merely aggravated or accelerated what was already underway and which would have unfolded anyway, given a year or two or three.
We are dealing with a resurgent and re-awakening and re-militarizing Islam, people.
If it wasn't Excuse A (for the revolts and violence and in-fighting amongst themseleves), ir would have been Excuse B... we were just the Excuse du jour.
Have we acted stupidly and foolishly, in thinking that we could talk sense into these Neanderthals, and bring about stability and lasting peace, and that we could nation-build, given the piss-poor raw material that we had to work with over there?
Yep.
Is is entirely (or even mostly) our doing?
Nope.
Enough of the whiny bleeding-heart hair-shirt behaviors...