I am guessing that your GPS has a mag sensor too. The mag sensor out of alignment will cause a worse fly away than loss of GPS signal.
Regardless of that, FC failsafe is generally triggered only when there is loss of signal from RC, otherwise which should it believe; the pilot who is trying to change modes and fly it back or the FC failsafe?
Generally, you should try to have redundant flight modes available and set up failsafe for when you don't have control.
In your case though, even switching to Attitude mode would not have cured it because the mag is used with the accels to determine what is level. Rate mode would have been the best, but that is difficult if a long way away with no FPV.