Which Hiboy model do you have? Some have regenerative brake which are independant of the mechanical brakes, so I’m curious which kind of brake failure it was. Which brake lever were you using at the time?
Sounds like the sensor for the brake lever either came unplugged or failed. The motor should definitely stop going any time the brakes are applied.