Erdogan wants the regional oil fields. He was one of the main ISIS supporters. As soon as ISIS is on the ropes, in rides the real problem.
Giving Turkey Afrin is probably the price of keeping them out of those oil fields in the east.
Geopolitically that would be a bargain (not morally).
The District is about an equilateral triangle with Turkey on two sides. IE: practically militarily indefensible.
Likely Afrin city can be saved by diplomatic and public pressure.