It's possible to make this argument about Afghanistan, but Iraq was completely unrelated to 9/11.
there certainly was a connection, if not a logical one
There's a connection to the gulf war, but that's about it. The threat of WMDs was a concoction. And Iraq is Shia majority, whereas the Wahhabi jihadists and the Taliban, the incubator for the 9/11 terrorists, are supported by Sunni majority countries with completely different and consequential views on their religious texts. After Iraq was 'liberated' from Saddam, a Sunni leader, Iran, another Shia majority country, has been able to take political control of the country.
And retaliating for the 9/11 attacks, of course.