Your analogies hold some validity concerning Afghanistan, where the Taliban government did support alQaeda, but it fails on Iraq. Invading Iraq in response to an attack on American soil by Afghanistan-trained Saudis would be like Franklin Roosevelt responding to the Japanese attack on Pearl Harbor by declaring war on Siam.
I would agree completely if I thought Iraq was invaded in complete and direct response to 9/11. I think the Bush administration was convinced Hussein had restarted his WMD projects, but I don't think they were honestly that concerned that he would give or sell those WMDs to terrorists. This is obviously conjecture, but Hussein's contacts with terrorists seem to be cautious and limited. We know (or think we know) he gave them money, but money is fungible. There's a big difference between giving terrorists money (basically buying favor), something that almost every Muslim country does one way or another, and giving or selling WMDs that could almost definitely be traced back to Iraq. The former we had already proven we weren't willing to resume the war over; the second was almost a sure bet for resuming the war until Hussein's removal, otherwise he would have used his WMDs in '91.
I think one of the main reasons behind invading Iraq was his standing in Islam as a symbol that the USA was a paper tiger that might kill a few hundred thousand soldiers, but that could be successfully resisted and backed down with courage. His constant attacks on US aircraft really amounted to little except to point out to the world that he was still unconquered and unrepentant. Remember also that the Democrats continually criticized Bush 1 for not removing Hussein, even though that was outside the UN mandate and certainly would have torn apart his coalition (albeit with little real effect; the USA and the UK formed almost all the combat power.) Combine those two things with the fact that Hussein had previously tried to kill Bush 1 (or maybe Clinton, I forget), the fact that he could have transmitted WMDs (even if it was unlikely he would), and the prospect of establishing an Islamic democracy in the Middle East as an example to other Muslims - and throw in the political capital Bush gained simply by being president when we were attacked - and I think you've got the core reasons. I admit that I'm too lazy to search out his actual list of reasons though. Too much Bush-bashing fluff to search through. LOL
I might be completely wrong, of course. Removing Hussein from power became official US policy under Clinton; Bush confirmed that policy, but did nothing about it until after 9/11, even after numerous acts of aggression and violations of earlier UN resolutions. And everything changed after 9/11, all threats were re-evaluated. Maybe they had real, pressing concerns about Hussein's ties with terrorists, that after 9/11 appeared more serious. But from the outside looking in, I'm guessing that the strongest reasons for invading Iraq were those existing before 9/11, not those as a result of 9/11. Since we already had the legal justification (violations of the cease fire if nothing else), the questions then were "can we do it", and "should we do it"? Obviously we could. Whether we should have done it is, at this point, I think anyone's guess.