There was 0 chance Ukraine was going to just flop over. Iraq and Afghanistan were humble villages by contrast - one which we lost to, and the other which our 'victory' amounted to bombing the government then hiding out in tiny little ultra fortified 'green zones' while waving a victory flag. In both cases with the wars dragged on for decades. Now imagine if Russia had decided to jump in one of those invasions and start shipping hundreds of billions of dollars of weapons to them, providing intelligence, and so on.
Russia obviously just thought they were ambushing Ukraine and could get some agreement for them to not join NATO without a real war. Then the West decided to get involved, similarly thinking they were ambushing Russia and that the first sight of HIMARS or a Panther tank would send the Russian army scattering.
Everybody was wrong, so we got a real war that nobody wanted.