Is there a way to have ardupilot swap to alt hold if the gps fails in loiter mode?
For software functionality problem, it is better to ask on Ardupilot forum, where more developers and users are there.
The answer for this question can be found on Ardupilot wiki
https://ardupilot.org/copter/docs/ekf-inav-failsafe.html#what-will-happen-when-the-failsafe-triggers