ESD destroys a MOSFET by creating too much voltage between gate and source, which permenently breaks down the gate isolation. The diode prevents this, as long as it is there, so it will work even outside of the circuit.
But if the diode is in the circuit, and the MOSFET is not, then it won't be able to repair the damage afterwards.
Quite a few MOSFETs have a separate, built-in Zener between gate and source. See the datasheet.
(If a through-hole MOSFET doesn't have it, you could short its legs together (with aluminum foil, a non-isolated paper clip, etc.) before handling it.)