There is another point worth mentioning. The U.S. Constitution requires the president to secure a declaration of war from Congress before he and his military can legally wage war against another nation-state. That never happened, which means that for 18 long years U.S. forces have been killing and dying in a war that is illegal under our form of government.
Of course, U.S. officials could tell the families of those two dead soldiers that they died so that U.S. officials could arrive at some face-saving arrangement with the Taliban that would enable them to withdraw from Afghanistan with "victory." My hunch, however, is that they're not going to tell family members that that's what their loved ones died for because that certainly wouldn't strike most anyone as being a worthy thing to die for.
The U.S. government should tell the families of those two dead soldiers the truth: they died for nothing, just as 58,000 American soldiers died for nothing in the Vietnam War. The realization that one's loved ones died for nothing would be painful but at least it would be the truth.