Does the enemy attack when we are weak? When we are distracted? Yes, historically there have been attacks when we have been weak and distracted. But we are also attacked when we are arrogantly standing on a hill declaring our greatness to the world.
So when did arrogance begin replacing weakness and distraction as the invitation for an attack? It happened after the First Gulf War, when the US people had shown they supported a fight. After that war, it became clear that the US public had changed since the Vietnam War. Kudos to President Reagan for reestablishing a fighting mentality in the people.
So why is arrogance and the willingness to fight an invitation for attack? In simple terms, the Cold War was a war of economic attrition with both sides betting that military spending would weaken the other side first. Enemies of the US took note, and knew that if the US was drawn into a protracted conflict, it would further weaken the US economy. If the US could be drawn into a preemptive or unilateral fight, then worldwide public opinion would also turn against and weaken the US.
This is the strategy of terrorism, peck at the king on the hill until he is overtaxed, spread too thin. Not so that victory can be achieved in a decisive battle, but so that the king will fall; fall from his own inability to stop reacting to the threat. Fall because rather than sharing the target on his back with allies, he will want to stand on the hill all alone. His arrogance will defeat his kingdom and not the enemy.