I think it would have been more punishment for the Soviets if we just let them keep Afghanistan.
They weren’t there to “keep it”; just like our presence in South Vietnam, they were asked by an ally (the Afghan government) to help control it. We certainly didn’t benefit when the Soviets left; we ended up with the situation today (mad Muslims armed with Soviet AND American weaponry).