How to protect the wires when the electrical box is mounted on a 2x4 stud?
Generally this isn't a concern. It's a very common scenario, and inspectors don't usually call for steel plates or anything. Use caution when hanging your drywall in those areas and don't worry about it.