I suppose if you pointed that out to an electrical inspector, he might say you need to replace the box?
As a practical matter, I would think some caulking squirted in the opening should hold the wire in place. (or liquid nails, whatever)
What I would be concerned about is sometimes connections inside electrical boxes arc and send sparks flying. I would rather not have large openings through which sparks could fly out and cause a fire. (Keep any potential sparks in the box is the idea...)