Spin-photon entanglement of a single Er$^{3+}$ ion in the telecom band