Why was indefinite occupation unacceptable? It was relatively cheap. In the same universe as what it costs us to maintain 10 times as many troops in South Korea.
To say that ripping the band-aid off was the only solution is an example of all-or-nothing thinking. It's letting the perfect be the enemy of the just good enough.
It was just good enough to keep the Taliban at bay and keep Afghanistan from being a great haven and staging base for international terrorism that it was in September 2001.
A mature great power accepts that there are limits to its power, but it doesn't adopt the attitude that if it can't achieve total victory then it will do nothing. After 100-plus years as a great power, we are still immature, and want to pick up our toys and go home when we can't get everything we want.
Amplifying on those points . . . .
Before the Civil War, the country was being torn apart in the debate over slavery.
The anti-slavery forces ranged from immediate abolitionists like William Lloyd Garrison, who wanted immediate freedom for the slaves, even if it meant dissolving the Union, to anti-slavery Democrats who were beginning to disagree with the mainstream of their party. In between were moderate anti-slavery advocates like Abraham Lincoln. Lincoln saw slavery as an abomination and wanted it gone. But he didn't want it gone only in the North, which is what it would have been had Garrison had his way. He wanted it eliminated while keeping the Union intact. He used a couple of metaphors to describe the difficulty in getting rid of it and also the danger of trying to eliminate it immediately.
One of his metaphors was a rattlesnake in a crib with a baby. Whaling away at the rattlesnake will likely result in it biting and killing the baby. So you have to be patient and try to coax the snake out of the crib without harming the baby.
The other metaphor was to a cancer--he called it a wen--on a person's body. If you cut it out, you will bleed to death. So you live with it while you try to find a treatment that will gradually get rid of it.
Neither of those is a particularly good analogy with Afghanistan. But they illustrate that sometimes the "rip off the band-aid" solution is not the best one.