The formula you mentioned is true for a smooth curve $C$ on a unit sphere of any dimension and it is a special case of the Kac-Rice formula; see Example 15 here.
Let me explain a bit this point of view. Suppose $C$ is a smooth curve on the unit sphere $S^n$ in $\newcommand{\bR}{\mathbb{R}}$ $\bR^{n+1}$. Fix an arclength parametrization of $C$
$$ [0,L]\ni s \mapsto \big( x_0(x),\dotsc, x_n(s)\big)\in \bR^{n+1}, $$$$ [0,L]\ni s \mapsto \big( x_0(s),\dotsc, x_n(s)\big)\in \bR^{n+1}, $$
where $L$ is the length of the curve, $(x_0,\dotsc,x_n)$ are the canonical coordinates in $\bR^{n+1}$, and
$$ \sum_{k=0}^n x_k(s)^2=1,\;\;\forall s. $$ Fix independent standard normal random variables $U_0,U_1,\dotsc, U_n$ and form the random function $$ F:=[0,L]\to\bR,\;\;F(s)=\sum_{k=0}^m U_k x_k(s). $$$$ F:[0,L]\to\bR,\;\;F(s)=\sum_{k=0}^m U_k x_k(s). $$ The zeros of $F$ correspond to the intersections of $C$ with the random Equator $$ \sum_{k=0}^n U_k x_k=1,\;\;\sum_{k=0}^nx_k^2=1.$$$$ \sum_{k=0}^n U_k x_k=0,\;\;\sum_{k=0}^nx_k^2=1.$$
Denote by $N$ the number of zeros of $F$. Another$\newcommand{\bE}{\mathbb{E}}$ Another version of the Kac-Rice formula will give you a description of the second combinatorial moment $\bE[N(N-1)]$$\bE\big[N(N-1)\big]$; see Theorem 3.2 in the book Level Sets and Extrema of Random Fields and Processes, by J.M. Azaïs and M. Wschebor, John Wiley & Sons, 2009.
It involves certain conditional expectations. If $L<2\pi$ these conditional expectations are more manageable since you can apply the regression formula from the same book above. If $L>2\pi$ it is conceivable that the in in some cases the variance is infinite. This is a speculation not a hard fact.