The first is that frozen conflicts are poison. When Russia and Hezbollah and Iran and some Syrian units were winning, rather than make an agreement for a frozen conflict, they should have pushed on. Leaving enemies in the country and the oil fields in US/Kurdish hands was foolish and fatal. Letting enemies flee to Turkey then be sent back was fatal.
The second is that either Russia or Iran should have just stationed some significant ground forces there permanently (Hezbollah is not a full state and doesn’t have the capacity.) Yes, it would be a bleeding ulcer, but the attrition would not be enough to matter. The entire advance could have been stopped by one good, properly equipped Iranian or Russian brigade with air and drone support. The Jihadis didn’t win because they were great fighters, they won because the Syrian army wouldn’t fight.
This assumes that the strategic value of Syria was sufficient: that it was worth the cost.
If Syria’s worth having, then do what it takes. Fighting on and off for thirteen years to then have the regime fall in days is ridiculous.
This argument applies to America in Afghanistan. The difference is that while Russia and Iran have important strategic interests in Syria, or did, the US never had enough in Afghanistan to justify the costs.
Broadly speaking, don’t half-ass. Do it right or don’t do it.