In the city of Worcester , Mass if I see this , no matter if I'm driving by or called to the address for an inspection, The it would be called to the owner's attention and they would be asked right there to get it fix , I'd give it a week or so then if it still wasn't done I would issue a violation notice in writing and give them 7 days to comply , ( this depends on the severity of the problem, some things like inoperable or out dated smokes are 24 hours ), if they don't comply they would end up with a COURT ORDER from a Judge , most comply with the verble order for correction
I've seen this sort of thing a lot- only difference being that the dangling wire usually feeds a 'handy box' receptacle. Would it be so bad if somebody made their lamps so that the wall plate could neatly attach to a 2-gang "Bell" box? Or had a lip wide enough for a 1/2" conduit punch? When you think about it, are there any lamps out there that are designed to be added after the house is built?