Microscopic Basis of Miedema's Empirical Theory of Transition-Metal Compound Formation