Ultimately money will dictate who is in goals next season.
Signing a new GK of at least the same standard (even the McGregor of now) will be costly whereas renewing AM for a season on the same wage would not incur a fee and may be a lower wage than younger replacements. Next comes investment in other areas of the pitch where arguably we are worse off for costing us points (lack of attacking potency, defensive errors, lazy midfield, injury proneness).
Re-signing AM also has the benefit of continuity, knowing/understanding the club culture, rivalries and standards and other things that can't be quantified.
Looking at it pragmatically I can see more pros than cons for re-signing him, even though he has been almost written off already (including by me).