We present X-ray spectroscopic evidence for the evolution of valence-specific spin states and tetragonal distortions in single-layer cobaltates. Measurements of Co $L_3$-edge resonant inelastic X-ray scattering reveal the $t_{2g}$ electronic structure of Co for hole-doped La$_{2-x}$Sr$_x$CoO$_4$ ($x$ = 0.5, 0.7 and 0.8). As the Sr-doping $x$ increases, the tetragonal splitting of the $t_{2g}$ states of high-spin Co$^{2+}$ decreases, whereas that of low-spin Co$^{3+}$ increases and the fraction of high-spin Co$^{3+}$ increases. The results enable us to clarify the origin of the change of magnetic anisotropy and in-plane resistivity in a mixed-valence cobaltate caused by the interplay of spin-orbit coupling and tetragonal distortion.