That evaluation is not correct.
First not whole country was not invaded. There were parts that stayed at the hands of Talibans and they slowly were regaining parts of the countries to US and their allies.
That occupation scheme by a much more powerful Army can be traced at the ancient ages. Both Germania and Britannia were well invaded by romans, but after decades or even a century, in the case of Britannia, occupation troops were expelled from those provinces.
The objectives of the occupation were overthrown taliban Government and installing the northern coalition but those failed miserably.
Their retreat let not only thousands of collaborators at the hands of the Taliban Government but also let behind billions of dollars in weapons including some UH60 and Embraer Tucano.
After war US tried to even rent or eventually take by force Bagram Air base. Talibans are still laughing.