We combine extensive precision measurements of the optically detected spin dynamics and magneto-transport measurements in a contiguous set of n-doped bulk GaAs structures in order to unambiguously unravel the intriguing but complex contributions to the spin relaxation at the metal-to-insulator transition (MIT). Just below the MIT, the interplay between hopping induced loss of spin coherence and hyperfine interaction yields a maximum spin lifetime exceeding 800~ns. At slightly higher doping concentrations, however, the spin relaxation deviates from the expected Dyakonov-Perel mechanism which is consistently explained by a reduction of the effective motional narrowing with increasing doping concentration. The reduction is attributed to the change of the dominant momentum scattering mechanism in the metallic impurity band where scattering by local conductivity domain boundaries due to the intrinsic random distribution of donors becomes significant. Here, we fully identify and model all intricate contributions of the relevant microscopic scattering mechanisms which allows the complete quantitative modeling of the electron spin relaxation in the entire regime from weakly interacting up to fully delocalized electrons.