Sometime it can be because you tap the brake ever so slighlty as you think a car will cut in say but as you like punched the peddle a little moving you foot accross quickly it slams them on.. The brake mangement thinks you need to emergency stop and slams them on as if you did for a split second. Plus the assited braking system sensor can become faulty and the pressure it detects is wrong.
I did have an issue with the golf a while back where it would have some sort of issue pulling away from traffic lights with brake hold and acc on. ( it didn’t move) it would just rev and you’d smell burning and you’d go no where. Till you hit the brakehold off or restarted the engine. happened probally 10 times on different occasions. Was a dsg meanwhile ppl behind was getting very angry as they do when you just sit there when lights go green . Then it never happened again, dealer could’nt fix it or find out why but I think it was some software issue glitch that an update it had fixed, when it went for it’s first mini service.