Harnessing symmetry-protected topological order for quantum memories