How would you do system-level testing on this system? Obviously there's going to be a simulator, but would you ever install it in a plane and dive at the ground?
Most likely there is a test mode that raises the altitude floor/projected flight path at which it takes over. You could then perform the level-off at a safer altitude.
So maybe one way to test this on a real plane would be to trick the software into thinking the terrain is 5000 feet higher than it is. Then it can execute the maneuver against a safe fake "ground", still giving the test pilot time to intervene if it doesn't work properly.
https://www.nasa.gov/offices/ipp/centers/dfrc/technology/DRC...
Essentially what you'd expect, in software then models then UAVs then full-scale planes with test pilots and finally roll-out to service aircraft.