Text this: Anisotropy-driven topological quantum phase transition in magnetic impurities