I'm spent more time reading the NEC than installing lag screws, so I'm probably not the best one to answer this question. Obviously there is a risk that you can't eliminate completely.
Knowing the existing construction details and having a good estimate of the thickness of build up from the face of the stud to the face of the finish will let you right size the fastener length to avoid excessive embedment. But even so, you often want to get more embedment than the 1-1/4" that any cables through the studs are supposed to be recessed from the face of the stud.
Maybe there are wall scanners that can detect live electrical wires, not sure about that. They might not pick up a circuit that happens to have no load on it, though. Looking at the reverse side of the wall for any clues as to how circuits might be routed could help.
The only other thing I can think of is to run the lag screw most of the way in, and then back it out and look at the chips for anything metallic.. Not sure if that's wise from a structural point of view, and wouldn't be certain.
It's certainly the case that if a breaker trips while/after driving a lag screw, and the installer ignores it, that's incompetence at best. The issue in the OP's case is that under this fastener hit a wire theory, it presumably did so in a way that didn't trip the breaker, didn't kill power to the load, and if there was an AFCI breaker didn't cause any of the arcing patterns it was programmed to detect. Instead it just caused a high resistance point in the circuit, which under sufficient load got hot enough to start a fire. Again, just a theory.
Cheers, Wayne