If you built that home illegally, then someone most certainly should have the right to take action. Also, building codes aren't exactly "arbitrary", ya know?
I'm sure the electricians did their usual standard of work
But you don't know. You can't know. Nobody knows and nobody can know, because -- by hiding the construction -- this guy almost certainly also hid it from the routine checks which would have provided that sort of information. Most work done by most contractors most of the time is probably fine, but inspections and other checks are there for the cases where the work isn't fine, because we've decided, as a society, that it's worth that overhead to avoid the nasty consequences.