The words win, lose, victory and defeat have no place in any such operation (other than at a tactical level). The best one can achieve for the overall effort, lacking using the Roman or Mongol models of total annihilation (frowned upon today) is an acceptable outcome. That's been true of virtually all of them since the end of WW II. Except Viet Nam which was unique in several respects; the insurgency was pretty well curtailed but the North Viet Namese conventional offensive overturned the nominal outcome.

Comparing WW II to Viet Nam in almost any respect is fallacious; that's tantamount to comparing New York to Pili. They're both cities but that about as close as you're going to get. The COINistas will tell you that insurgencies average about ten years to 'resolve' as you note.

The issue of what that resolution will be is undetermined -- or at least so far as is made public. I think your comment:
is the inability to achieve that objective a consequence of operational failure or was the objective unreasonable from the start? If we'd gone in with the assumption that achieving basic security and stability could easily take a decade and a functional government could need another, we'd be right on schedule.
is on the mark. The initial plan was to topple the Talibs and leave; rightly or wrongly and for reasons not fully known, that got changed and we, the USA in the form of the government of the day, told the Afghans we would stay and 'fix it.'

Error on our part IMO but they didn't ask me. So we said it. Now, we're honor bound to do it, I think. There is, I gather much back and forth in DC at this time on precisely what that means and I suspect that what the former Administration intended does not square with what the current Admin desires, however, the former Admin stacked some things that cannot be easily undone so the current Admin is trying to find acceptable to them solutions. That's about as clear as Afghan politics -- which are no better or worse than ours, just different...

Long way of agreeing with you, except I'd say that getting to a decent level of security will take much more than a decade and I doubt we'll stay long enough to do that. An acceptable level will have to suffice suffice...