What does this bidirectional TVS diode do
Clamping the primary voltage also clamps the secondary voltage, by a factor related to the turns ratio of the transformer. This is presumably to keep the electrode voltages in a "painful, but non-lethal" range.

Also, the resonant tank circuit on the transformer primary makes sure that the AC voltage is at a very high frequency, so that the "skin effect" keeps the current from penetrating into deep tissue and affecting critical organs. This tank is excited periodically by the chattering of the relay.