Anomaly matching and symmetry-protected criticality in 1d quantum many-body systems