Or even something as simple as studs that come pre-drilled at outlet and switch height (they already come pre-cut to slightly less than 8 feet to be the right height when installed between top and bottom plates).
Also, outlet/switch boxes get nailed to the studs during construction, and modifications to those boxes are fastened to the drywall, in my experience.