Let's take a direction eigenket $|{\bf\hat{n}}\rangle$ in 3-dimensional space oriented with angles $\theta\in\left[0,\pi\right]$ and $\phi\in\left[0,2\pi\right]$ in spherical coordinates. Next take the $|{\bf\hat{z}}\rangle$ direction eigenket.
There are infinite rotations which take $|{\bf\hat{z}}\rangle$ to $|{\bf\hat{n}}\rangle$, but in particular we can consider a specific rotation given by the following operator (Wigner D-Matrix) written with Euler angles $(\alpha,\beta,\gamma)$:
\begin{align} &\mathcal{D}(R)=\mathcal{D}(\alpha=\phi,\beta=\theta,\gamma=0)\\ &\implies|{\bf\hat{n}}\rangle=\mathcal{D}(R)|{\bf\hat{z}}\rangle \end{align}
Notice that if we change the value of $\gamma$ the equation remains valid (because $\gamma$ represents a rotation about ${\bf \hat{n}}$ axis). This is the same notation that appears on Sakurai and Wikipedia. Next it is shown a relation with spherical harmonics (from Sakurai & Napolitano, sec. 3.6 pp 205-206):
\begin{align} &|{\bf\hat{n}}\rangle=\mathcal{D}(R)|{\bf\hat{z}}\rangle\\ \implies &|{\bf\hat{n}}\rangle=\sum_{l',m'}\mathcal{D}(R)|l',m'\rangle\langle l',m'|{\bf\hat{z}}\rangle\\ \implies \langle l,m &|{\bf\hat{n}}\rangle=\langle l,m|\sum_{l',m'}\mathcal{D}(R)|l',m'\rangle\langle l',m'|{\bf\hat{z}}\rangle\\ \text{Using that}&\ \text{$\mathcal{D}(R)$ doesn't change the $l'$ number:}\\ \implies Y_{l}^{m*}(\theta,\phi)&=\sum_{m'}\langle l,m|\mathcal{D}(R)|l,m'\rangle\langle l,m'|{\bf\hat{z}}\rangle\\ \implies Y_{l}^{m*}(\theta,\phi)&=\sum_{m'}\mathcal{D}^{(l)}_{m,m'}(R) Y_l^{m'}(\theta=0,\phi)\\ \text{And using that}&\ \text{$Y_l^{m'}$ vanishes at $\theta=0$ for $m'\neq 0$:}\\ \implies Y_{l}^{m*}(\theta,\phi)&=\sqrt{\frac{2l+1}{4\pi}}\mathcal{D}^{(l)}_{m,0}(R)\\ \end{align}
This gives a relation between the rotation operator $\mathcal{D}(R)$ and spherical harmonics. It does not seem in any step of the derivation that $\gamma=0$ is necessary. I think that if we choose another rotation $R$ with $\gamma\neq 0$ such that $|{\bf\hat{n}}\rangle=\mathcal{D}(R)|{\bf\hat{z}}\rangle$ the relation remains valid, but this is weird because if $R$ changes then the operator $\mathcal{D}(R)$ changes (and $Y_l^{m*}$ doesn't change).
My question is: Why the spherical harmonics represent rotations with $\gamma=0$ and not another value? and, if we have a rotation with $\gamma\neq 0$, can we write it with spherical harmonics?