Just confirming; there is a ground wire to the pump, as well as a ground check wire, yes?
When you have these setups, the ground check wire is connected to the motor frame somewhere other than the ground wire. Using a low voltage montoring circuit, you can check the integrity of the ground connection. Essentially, theres a power supply and a relay, and the power supply goes to the relay, then to the ground check wire. The other side of the power supply goes to the gound wire.
If the ground monitoring fails, then the relay opens, removing power to the device.
I know you guys dont use these connectors much, but the CEE17 series of industrial connectors are available with one or two extra pins ("pilot pins"), and this is often used for that type of connection. The ground pin contacts first, then the power pins, and then the pilot pins. Pull the plug and the pilot is first to break contact.