A comprehensive understanding of ground and optically-excited hyperfine structure of $^{167}$Er$^{3+}$:Y$_2$SiO$_5$