The previous owners (flippers) left a surprise behind the drywall in my basement, and it was not just the absence of insulation. What is the best way to work with these holes? I want to replace the electric boxes themselves with newer low-profile versions that will not need such creative arranging.
There should be a steel plate over that notched stud /joist to prevent the wire from being damaged when sheet rock is installed as it is less than 1-1/4" from the nailing surface. The single gang box can be moved forward on the stud to make it a flush mount. The 4x4 box is easier, a 1/2" single device mud ring can be put on the face of the 4x4 box that should bring it out to the Sheetrock surface. You may need to keep the 4x4 box depending on the numbers of wires in the box (box fill) other than the nail plate and the boxes at the wrong depth I don't see obvious problems. An electrical inspector should have caught the boxes being two far back prior to the "cover" inspection. You might want to verify the work was permitted and inspected and may have legal rights if the work was not disclosed.