Monomial preserving derivations and Mathieu–Zhao subspaces