NM is not approved for installation as you have described only for the reason that a approved cable connector will not be used at the point where it enters the box.

Code violation...yes.

Hazard to people and property...no.

shortcircuit