Therefore, $H$ is invariant under rotations because a scalar is invariant under rotations.
No, it's not. It's rotationally invariant if and only if you rotate the magnetic field together with the system. If the field is externally imposed and you don't rotate it with the system, then rotating the system will change the dynamics.
The same is true in quantum mechanics. This is wrong:
Quantum mechanically, for $H$ to be invariant under rotations, one must have $[H,S_i]=0$ for $i=x,y$ and $z$. In the present case, $[H,S_i]\neq 0$, $\forall$ $i=x,y,z$.
Instead, for rotational invariance you need $H$ to commute with the generator of that rotation, which needs to be the total angular momentum $\mathbf J=\mathbf L+\mathbf S$ for the entire system, including the magnetic field; once you do that, you find that if $\mathbf B$ rotates with $\mathbf J$ via the standard vector rules, then
$$
[\mathbf J, \mathbf S\cdot \mathbf B]=0.
$$
(It's maybe worth doing this in detail. Thus, make $\mathbf B$ transform according to the standard $[L_i,B_j]=i\hbar \epsilon_{ijk}B_k$, which is what you get if $\mathbf B$ is a dynamical variable that's part of your system and subject to the rotations generated by $\mathbf L$, and then calculate
\begin{align}
[\mathbf J, \mathbf S\cdot \mathbf B]
& =
\hat{\mathbf {e}}_i \left[ J_i, S_j B_j\right ]
\\& =
\hat{\mathbf {e}}_i \left( \left[ J_i, S_j\right] B_j + S_j\left[ J_i, B_j\right] \right)
\\& =
\hat{\mathbf {e}}_i \left( \left[ S_i, S_j\right] B_j + S_j\left[ L_i, B_j\right] \right)
\\& =
\hat{\mathbf {e}}_i \left( i\hbar \epsilon_{ijk}S_k B_j + S_j\: i\hbar \epsilon_{ijk}B_k \right)
\\& =
\hat{\mathbf {e}}_i i\hbar \:\epsilon_{ijk}\left(S_k B_j + S_jB_k \right)
\\ & = 0,
\end{align}
assuming Einstein summations, where the last term vanishes because you're contracting an asymmetric tensor, $\epsilon_{ijk}$, with the symmetric combination $S_k B_j + S_jB_k$. If you do anything other than this, then the cancellation will fail and you'll be left with a nonzero commutator.)
And, in the opposite direction, the operator-commutator shenanigans are in no way unique to QM - you just need to swap commutators for Poisson brackets and you get exactly the same structures within classical mechanics. Once you define a (classical) intrinsic angular momentum $\mathbf S$ that generates rotations for $\boldsymbol \mu$, then all the structures are preserved exactly.