I don't think margin() first verifies that the closed loop system is stable. It just applies the gain and phase criteria to the input its given. As always, one needs to (or at least should) verify that the closed loop system is stable before computing stability margins. The allmargin() function can do this, but it doesn't make a bode plot.
Note that the last field, 'Stable', indicates that the closed loop system is unstable, which means the GainMargin and PhaseMargin don't take on their usual meaning. Also, the GainMargin is given in absolute gain, not dB.