I assume you are referring to NEC 314.23. If so, your understanding of the NEC is not what the code actually specifies. I have bolded the portions that matter.
NEC 314.23. Supports. (B) Structural Mounting. (1) Nails and Screws. Nails and screws, where used as a fastening means, shall be attached by using brackets on the outside of the enclosure, or they shall pass through the interior within 6 mm (1/4 in.) of the back or ends of the enclosure. Screws shall not be permitted to pass through the box unless exposed threads in the box are protected using approved means to avoid abrasion of conductor insulation.
A master electrician did this in my old house. And this also passed inspection. Although admittedly that doesn't mean much.
As @aaiyar pointed out my statement applies to to both wire nuts and wagos. I am not trying to stir that pot. Both of those take up excess room and it is best to avoid if possible.
I never mentioned back stabbing. All of my smart switches GE, Inovelli, and Zooz all have 2 holes per screw terminal. I am suggesting to use both when possible to save room.
Let’s stop the nitpicking and move on to the OPs question. I am tapping out.
I actually don't care that you do this, but I don't think we should recommend it without a disclaimer.
Screwing through the side of an "old work" box creates an unapproved field-made mounting hole. The box is designed to be secured to the drywall using the integrated clamps and ears, not to the structural framing.
You guys are really defensive. As has been stated elsewhere just let people know it's your opinion and if uncomfortable or unsure use a licensed professional.
Not an electrician, but @aaiyar posted what appears to be a relevant snip from the NEC that backs up his assertion that alterations on the work box like the one he performed can be compliant.
You keep insisting you’re right (or that he’s wrong), with little additional explanation or reference. That sounds like an opinion to me too.
110.3(B) Installation and Use.Equipment that is listed, labeled, or both, or identified for a use shall be installed and used in accordance with any instructions included in the listing, labeling, or identification.
Boxes like that are listed. If you are drilling holes anywhere there should not be a hole it violates code and the listing of the product. This is how the codes work together.
Of course this is available with basic internet searching these days.
Fortunately y'all's disagreement is moot because I want to use an old work box so I don't have to nail it into a stud. That's the whole point of using the old work box.
They are greatly superior to any old work box out there. Available in various configurations.
Tip: use a good bit on an impact driver and go slow. It's not terribly hard to strip the screw head if you're dealing with hard 2x4's in old houses, or if you use an old worn-out bit that doesn't grip the screw head properly.