Emergent discrete 3-form symmetry and domain walls