It's important to note that by assumption of $A\in S^n$ and $B\in S^n_{++}$ (e.g. that $A$ is symmetric and $B$ is symmetric positive definite). Then
$$
A\prec r B \iff \sup_{\|u\|_2 =1 }u^T(A-rB)u < 0. \quad (*)
$$
Define $\bar u$ by the generalized eigenvalue (the $u$ that achieves the supremum in $(*)$).
Since $B$ is symmetric positive definite, then for any $u\neq 0$, $u^TBu> 0$, so $(*)$ is equivalent to
$$
\frac{\bar u^TA\bar u}{ \bar u^TB\bar u } < r.
$$
Since the problem is to minimize $r$, the optimal solution to the SDP is in fact
$$
\frac{\bar u^TA\bar u}{ \bar u^TB\bar u } = r.
$$
It is left to show that
$$
\frac{\bar u^TA\bar u}{ \bar u^TB\bar u } = \sup_u \frac{u^TAu}{ u^TBu }=\lambda_{\max}(A,B) .
$$
Assume that it is not true, e.g. there exists $\hat u$ where $$\frac{\hat u^TA\hat u}{\hat u^TB\hat u} - \xi= \frac{\bar u^TA\bar u}{ \bar u^TB\bar u } = r, \quad \xi > 0. $$
Then
$$
\hat u^T(A-rB)\hat u = \xi \hat u^TB\hat u> 0 > \sup_{\|u\|_2=1}u^T(A-rB)u
$$
which is not possible. Therefore $\lambda_{\max}(A,B) = r$.