Nearly all of the mistakes in Iraq (including the decision to invade in the first place) were made at the political level, above the military. Bush decided to invade the country, Rumsfeld decided to commit too few troops to effectively occupy the country, and Obama decided to set a hard public deadline for withdrawal that allowed the insurgency groups that turned into ISIS to plan and bide their time.
The military can’t question the orders they receive from the president and Secretary of Defense. That’s an important part of maintaining civilian control over the military. The military can only try to carry out whatever goals and decisions they’re given by the politicians, and in Iraq the politicians (from both parties) got it wrong.