The band ordering of semiconductors is an important factor in determining the mobility and coherence of the wave function of carriers, and is thus a key factor in device performance. However, in heavily doped semiconductors, the impurities substantially disturb the band ordering, leading to significant degradation in performance. Here, we present the unexpected finding that the band ordering is suddenly restored in Mn-doped GaAs ((Ga,Mn)As) when the Mn concentration slightly exceeds ~0.7% despite the extremely high doping concentration; this phenomenon is very difficult to predict from the general behaviour of doped semiconductors. This phenomenon occurs with a ferromagnetic phase transition, which is considered to have a crucial role in generating a well-ordered band structure. Our findings offer possibilities for ultra-high-speed quantum-effect spin devices based on semiconductors.