That is only true if you believe that the cause of terrorist attacks is primarily ideological. A strong alternative view is that 9/11 was just another event in a long chain where the US meddles with Arab issues and that angers a lot of people in that area of the world, leading to blowback. This is a very important concept, because if it is true (and there is definitely research on showing so), the only thing that will definitely NOT stop the radical attacks is doing even more to make people in the Middle East angry and desperate by bombing/invading their countries.
Just think of the reactions of people in any country to military invasion and occupation. How stupid one has to be to believe that by bombing people we will surely make them not want to attack us.
What should have we done instead? Well, that is a hard question, because as far as we think we should be the ones deciding every little conflict in the world, we should expect blowback as a consequence. And we can kill the families of the terrorists, invade their countries, etc. — the more we react in kind, the more of them we create. So if we are a truly just country, we simply do the same as with any other criminals. Prosecute anyone we can, but don’t create even more reasons for terrorism.
