I would argue that the taliban's scorecard in Afghanistan is pretty good.
Taliban insurgency vs USSR (technically vs "People's Democratic Party of Afghanistan", who, one might add, killed more people in peacetime than the Taliban did in wartime). They had the support of the entire population, because, frankly, the Taliban are an improvement over these communists. Communists left to make the terror attacks stop, and because the USSR collapsed.
Taliban insurgency vs US/International Coalition. They certainly did not have widespread support, with constant claims that it's much less than 50% (in an election, not that 50% of the population was prepared to fight). Essentially the coalition left and the Afghan government surrendered to make the terror attacks stop.
There's 2 lessons here. First, what matters is who's willing to fight (and equipment, to a lesser extent). Afghans are willing to vote against Taliban, but that's just not enough. The Taliban are some 10-20% of the population, and have since betrayed part of their own groups, so it's less now. Part of the problem is that nobody sees a future in Afghanistan under a decent government (or under the Taliban, but that doesn't matter, it's mostly people who can't leave). Two: terror and destroying everything and everyone until you're the only option left ... at least that can work. Communists demonstrated it doesn't work if you keep killing everyone but the Taliban don't do that. Life is terrible under the Taliban, but they don't kill large amounts of people, or at least not quickly. And the UN doesn't mind working with the Taliban, they're even prepared to exclude women from UN departments that work with the Taliban, so I guess that means they're "accepted".
I believe it's fundamentally an economic problem. Either there is some way to give Afghanistan a decent economy that depends on it's people, at which point the Taliban will have to make big concessions, or everyone basically "exchanges terror" with Afghanistan (not the Taliban, the entire population, the same problem as in Gaza if you will) to maintain some kind of balance. They kill/attack/kidnap/... people around the world, effectively in schemes to get money. The rest of the world attacks Afghans and Afghanistan to keep their terror below a reasonable level.