Lock‐and‐Key and Shape‐Memory Effects in an Unconventional Synthetic Path to Magnesium Metal–Organic Frameworks