A weighted difference of the $g$-factors of the Li- and H-like ion of the same element is studied and optimized in order to maximize the cancellation of nuclear effects. To this end, a detailed theoretical investigation is performed for the finite nuclear size correction to the one-electron $g$-factor, the one- and two-photon exchange effects, and the QED effects. The coefficients of the $Zalpha$ expansion of these corrections are determined, which allows us to set up the optimal definition of the weighted difference. It is demonstrated that, for moderately light elements, such weighted difference is nearly free from uncertainties associated with nuclear effects and can be utilized to extract the fine-structure constant from bound-electron $g$-factor experiments with an accuracy competitive with or better than its current literature value.