Well, I would give 100% chance that there's definitively somes valves that where bent. $4000 sounds about right (if your mechanic is charging $75-85/hr in labor). Engine removal and install can be labor intensive and engine rebuild is very costly. New seals, pistons which on a 1.9L TD are quite expensive, valves, hopefully no extensive damage to the head, Crankshaft is reasuable assuming it's within spec. Make sure you modify the crank to be able to fit a TDI crank pulley, I could go on. I guess, you got to ask yourself that dangerous question. Is it worth spending all that money. Well one way to look at it is, you got a fresh engine, that's pretty much gona out last the life of your car.
I'm sorry for your misfortune and hope everything works out for you in the end.
P.S. does the quote include removal & instal of the engine?