Hi,
You should be able to put an electric brake on the motor and use one of the G540 relay outputs driven by the Mach3 Enable output to release the brake when the G540 is disabled, when Mach3 is in Reset.
As to detecting if a motor wire becomes unplugged, you need to solve that problem by ensuring that it doesn't become unplugged. If necessary you can buy cable designed for continuous flexing that will not fatigue like standard cabling.
When a motor is unplugged while operating, there is a good chance that you will damage the drive for that axis. I recenly repaired a G540 where this occurred. I replaced the axis drive, but the motor movement was intermittent, making a loud clunking noise.
In the end I un-soldered the DE-9 connector off the G540 motherboard and when I did a continuity check on the pins, one was open circuit. The customer sent me the attached image of the mating connector.
It was clear from the image that an enormous amount of energy passed through the pins when the disconnection occurred, destroying the pin in the connector on the G540 and the axis drive.
Cheers,
Peter