This may be a naive take, but it's something I've thought about a fair bit.
What if the USA had taken half its military budget over the last 20 or 30 years, a huge amount, and used that money to do good works around the world? Wouldn't that make it much harder for any state or non-state actor to organize an attack? (E.g. "You want us to hate America? But they just built the school my child attends... Maybe I'll support the guy who wants to open trade talks instead")
But they've taken that money and waged war against people who you can hardly blame for feeling like maybe the West isn't so great. The harder you fight against "Terror" the stronger it gets.
Of course I've vastly oversimplified it, but it just seems like a tragically wasted opportunity.