If a plane is diving straight towards the ground at 500 m/s how high up must he pull out of the dive to avoid hitting the ground.

I can only do this if it is assumed that the plane continues at 500 m/s in a vertical circle.

Then it depends on how much centripetal acceleration the plane can achieve and the pilot stand.
At the bottom of the circle the total force up on the wings and other surfaces must equal the gravitational force plus give the centripetal acceleration.
(v^2/r + g) = max acceleration up plane can achieve with flaps down and nose up
(v^2/r + g) = max acceleration up on pilot before pilot blacks out.
take the maximum acceleration of those two, use 500 for v and 9.8 for g and solve for r.