Best thing to do with that mess would be to unscrew the trim tab bolt, pull it out (with socket attached), and then retighten the trim tab bolt. Maybe the "mechanic" pounded the socket on the bolt, it's the wrong socket, or it just ended up being tight.
If you put a dab of grease on the bolt head, the socket might release better after the bolt is tightened.
<edit> You said the bolt was loose, have you removed the trim tab? If so, then the trim tab bolt is hanging below, right?
If the socket is getting stuck on the way out, then the head of the trim tab bolt is jammed tight into the socket. This bolt has a flange on it and there's no way the bolt is going out the top.
What I would do is thread a nut onto the end of the trim tab bolt, then grab the nut really tight with a pair of Vise Grips. Pull the socket up as far as you can, then grab the socket with Vise Grips so it can't fall back down in the trim tab bolt-hole.
You may be able to tap the trim tab bolt out of the socket from the top by using a small screwdriver or suitable driver tool. You can also rap on the lower set of Vice Grips that are attached to the trim tab bolt via nut. Or grab onto the trim tab bolt directly, if that doesn't work. You'll likely ruin the bolt threads, though, if you do it that way.
Anyway, hope that added explanation helps. Took a while for my "pea brain" to assimilate what was actually going on!
HTH..........ed