Most intelligence insiders disagree with this logic.
It is true that AQ stuck it creditability on victory in Iraq and Afghanistan. However, they were absolutely planning on numerous, successful follow up attacks on US soil. The thought was that they could collapse the US economy and start a world wide Islamic revolution.
The fact that they have failed has created a serious problem for them, leading to a chain reaction of lower support worldwide.
They really fail to see, or grasp in the slightest that US attacks unite the American populous. They keep thinking about Spain, and decades of US retreat in the face of aggression; ie., Beirut, Somalia, etc.
If they were really concentrating their efforts on attacking us here, we would have been hit regardless of our counterterrorism measures. Just walk down the street sometime and look at all the potential targets, there are thousands of them, and you don’t need to be a genius to derail a train, bomb a ferry or do a Timothy McVeigh. We’re a free society and that means we’ll always be somewhat vulnerable. Heck, look at Israel. They take security VERY seriously and they still can’t stop all the attacks.