Historically, the Stern-Gerlach experiment showed the quantization of some internal degree of freedom, as you say. In particular, we expect a Hamiltonian term of the form $\vec{\mu} \cdot \vec{B}$, where $\vec{B}$ is the applied magnetic field and $\vec{\mu}$ is the magnetic dipole moment of the particle in the field. The experiment revealed that the component of $\vec{\mu}$ parallel to $\vec{B}$ is quantized with values $\pm \mu$.
I'm not totally sure about the precise timeline of what I've written below, but the ideas are correct.
The connection to angular momentum is that we associate these two quantized values with a current that rotates clockwise or counterclockwise about the $z$ axis. Basically, a nonzero magnetic dipole moment is associated with nonzero angular momentum of some charged particle(s). At this point, one might suspect that the electrons and nuclei of silver atoms had some net angular momentum that, when multiplied by charge, was equal to some nonzero magnetic dipole moment, which the Stern-Gerlach experiment revealed to be quantized.
But there was still some confusion. We would later realize that electrons have magnetic dipole moments even though they are pointlike --- without a notion of "size" there isn't really any rotating current, per se. Moreover, when we worked out the solution to the hydrogen atom, we found that angular momentum --- the conserved quantity corresponding to rotations of 3d space --- is quantized to have an odd number of allowed states, rather than the two possibilities observed in Stern Gerlach.
In general, symmetries correspond to mathematical groups, and continuous symmetries correspond to Lie groups. The elements of any group can be represented as a matrix acting on some vector space (e.g., a Hilbert space), which gives some intuition for why quantum states are vectors and observables are matrices (or operators). Additionally, the elements of a Lie group $G$ are generated via exponentiation of the generators of the corresponding Lie algebra $\mathfrak{g}$. The elements of the Lie group $\mathsf{SO}(3)$ corresponding to rotations of 3d space can be written as $\exp \left( i \vec{\alpha} \cdot \vec{J} \right)$, where the objects $J_k$ generate the corresponding Lie algebra $\mathfrak{so}(3)$, and satisfy the relation $[J_i,J_j] = \epsilon_{ijk} J_k$. Other Lie algebras have different relations.
There is also the Lie group $\mathsf{SU}(2)$ of $2 \times 2$ complex unitary matrices with determinant one. Interestingly, its Lie algebra $\mathfrak{su}(2)$ is equivalent to the Lie algebra $\mathfrak{so}(3)$! In other words, the generators satisfy the same rules. However, the Lie groups are not equivalent. Instead, $\mathsf{SU}(2)$ forms a projective representation of $\mathsf{SO}(3)$. A standard representation of a group $G$ is a map $\Omega$ on the elements of $G$ such that, for any $u$ and $v$ in $G$,
$$\Omega(u) \cdot \Omega(v) = \Omega (u \cdot v),$$
meaning that $\Omega$ preserves the structure of the group $G$. Usually $\Omega(u)$ is a matrix. On the other hand, a projective representation satisfies
$$\Omega(u) \cdot \Omega(v) = e^{i \theta (u,v)} \, \Omega (u \cdot v),$$
meaning that it reproduces the group action up to complex phases $e^{i \theta} \in \mathsf{U}(1)$.
Representations of the Lie group $\mathsf{SU}(2)$ are generically projective representations of $\mathsf{SO}(3)$. We label representations of both groups according to their "spin," which is a math term that doesn't mean anything actually spins, per se. Anyway, these representations of different spin can be understood in terms of the Lie algebras, which for these two groups are equivalent. While $\mathsf{SU}(2)$ admits integer and half-integer spin representations, $\mathsf{SO}(3)$ only admits integer spin representations. So the half-odd-integer-spin representations of $\mathsf{SU}(2)$ are projective representations of $\mathsf{SO}(3)$, while integer-spin representation are equivalent for both Lie groups.
So intrinsic spin --- e.g., as related to the magnetic moment in the Stern-Gerlach experiment --- has some intimate mathematical connection to angular momentum, as it comes from (possibly projective) representations of the rotation group for which angular momentum is a generator.
However, physicists were initially skeptical of intrinsic spin, and were not sure of its existence. This changed when Einstein (I'm pretty sure) showed that representations of the Lie group $\mathsf{SO}(3,1)_+$ were equivalent to representations of $\mathsf{SU}(2) \times \mathsf{SU}(2)$. The group $\mathsf{SO}(3,1)_+$ is known as the "orthochronus Lorentz group," which you should think of as the symmetries of special relativity. The group corresponds to rotations of 3+1d spacetime that preserve the direction of time; it includes rotations of 3d space about the three axes and Lorentz boosts of 4d spacetime along the three axes. One of the two $\mathsf{SU}(2)$s above corresponds to the rotational part of $\mathsf{SO}(3,1)_+$, and the other corresponds to the relativistic-boost part of $\mathsf{SO}(3,1)_+$. We associate the former with intrinsic spin and the latter with matter versus antimatter! This is also where the Dirac equation comes from with its four-component spinors.
So intrinsic $\mathsf{SU}(2)$ spin really does come from rotational invariance / angular momentum --- it's just that it comes from the relativistic version thereof that accounts for boosts too. Importantly, the spin-statistics theorem also requires that fermions have half-odd-integer spin, corresponding to projective representations of $\mathsf{SO}(3)$, while bosons have integer spin, corresponding to ordinary representations of $\mathsf{SO}(3)$.