Is it possible to prevent sacrificial anode contaminate the soil?
I wonder if a sacrificial anode near the surface could prevent corrosion at the deepest part of your pipe, where the water and wet soil are. Usually, sacrificial anodes are placed fairly close to the item being protected.

It would be worth testing some of the water (that comes up thru the pipe) for pH and corrosivity. If the water is alkaline (hard water), it may not be very corrosive. The oxygen level far below ground would be low, perhaps not enough for rapid corrosion.

Maybe a sacrificial anode is unnecessary.