Let's flash back to a discussion we had about my 1957 house.

I had expressed amazement at the unfused, un-disconnect-able service wires that ran for about 20 feet, from the back of the meter pan to an interior panel, just under the surface of the bedroom drywall. Why, I observed, any errant nail could easily hit the wire, and you'd have no way to turn off the power.

Indeed, this very room had the drywall covered with cheap paneling ... long nails all over the place. It was a miracle they missed all the wires.

The result of our discussion? It was pointed out that cables /wires need protection ONLY where they penetrate studs; as soon as that wire leaves the stud, it needs no protection, no setback, from the wall face at all.

The same applies to the boxes mentioned by the OP. Unless the box is set into a notch in a stud, it needs no protection, no setback, no matter the material.