To further this question, if a batter is batting out of order and the bases are loaded and all three of the runners score on wild pitches during that at bat, after the batter is either out or safe and then the batting out or order is called do all of the runners have to return to their bases?
The batter is not officially out of order until they have completed their at bat. If the incorrect batter were discovered while still at bat, the correct batter replaces the incorrect batter and assumes the count. In the situation you have presented, the only possible run that may be called back is if ball 4 happened to be a wild pitch and a run scored. In this situation then all action on that particular pitch would be nullified, but all previous action of the at bat would stand.
Any advances on the bases (wild pitches, passed balls, straight steals) that are not a result of the improper batter putting the ball in play or becoming a batter-runner stand.