The ability to 'replace' another compound is associated with relative volatility of the compounds in a particular reaction. For example:
Mg + 2 KOH --> MgO + H2O (g) + 2 K
a reaction that is dangerously exothermic. Similarly, for Mg and NaOH (do not attempt this reaction either). Magnesium, of course, is not considered more 'reactive' than either Potassium or Sodium.
But extreme heat is not always needed, as I have read in a recent work that Magnesium alkoxide, for example, behaves similarly in being able to form a double replacement reaction with more reputedly more active elements.
And, that's not all, an old reference notes the important of the volatility of an acid along with the reactivity of the constituting element in directing reactions.
Now, you are a bit more of a chemist and possibly very confused (it comes with the territory).