Let's define $G_n$ to the be the directed graph with vertices $\mathbb Z/n\mathbb Z$ and edges $k \to 2k$.
Why is this graph relevant? Because whenever $p$ is prime, there is a primitive root mod $p$: an nonzero element $r \in \mathbb Z/p\mathbb Z$ such that the elements of $\mathbb Z/p\mathbb Z$ are $0$ and $1, r, r^2, r^3, \dots, r^{p-2}$, with $r^{p-1}=1$. Excluding $0$ (which forms a cycle in the squaring graph) the rest of the squaring graph is isomorphic to $G_{p-1}$, so the question is: how many cycles does $G_{p-1}$ have?
Moving on to $G_n$: when $n$ is even, we can separate is vertices into odd vertices and even vertices. The odd vertices $1, 3, 5, \dots, n-1$ will have edges to distinct even vertices. The even vertices $0, 2, 4, \dots, n-2$ will only have edges to each other, and they form a copy of $G_{n/2}$. Therefore $G_n$ and $G_{n/2}$ have the same number of cycles. Repeating this for each factor of $2$, we reduce to the case that $n$ is odd.
When $n$ is odd, multiplication by $2$ invertible mod $n$; therefore every vertex in $G_n$ has indegree $1$ as well as outdegree $1$. It is a cycle or a disjoint union of cycles. One of these cycles is the $0 \to 0$ cycle, and we ignore it. Another one of those cycles has the form $$1 \to 2 \to 4 \to \dots \to 2^k \to 1$$ for some $k$. In fact, whatever $k$ happens to be, it is not just the length of the cycle containing $1$, but the length of every cycle except $0 \to 0$, because each nonzero $a \in \mathbb Z/n\mathbb Z$ is contained in the cycle $$a \to 2a \to 4a \to \dots \to 2^ka \to a.$$ Therefore there are $1 + (n-1)/k$ cycles of length $k$. What is $k$, in this case (where $n$ is odd)? It is exactly the multiplicative order of $2$ mod $n$. Note that $G_1$ just has one cycle.
Working backwards: when $n$ is even, let $2^t$ be the highest power of $2$ dividing $n$. Then $G_n$ has $1 + \frac{n/2^t - 1}{k}$ cycles, where $k$ is the multiplicative order of $2$ mod $n/2^t$.
Finally, to answer the original question, let $2^t$ be the highest power of $2$ dividing $p-1$. Then the squaring graph has $2 + \frac{(p-1)/2^t - 1}{k}$ cycles, where $k$ is the multiplicative order of $2$ mod $(p-1)/2^t$. (We add $1$ to include the cycle $0 \to 0$ where this is the $0$ in $\mathbb Z/p\mathbb Z$.)
For example, when $p=17$, we can write $p-1=16$ as $2^4 \cdot 1$, and $G_1$ just has one cycle, so the squaring graph has two cycles.
When $p=29$, we can write $p-1=28$ as $2^2 \cdot 7$, and $G_7$ has three cycles ($0\to 0$, $1 \to 2 \to 4 \to 1$, and $3 \to 6 \to 5 \to 3$), because the multiplicative order of $2$ mod $7$ is $3$. so the squaring graph has four cycles. The formula is $2 + \frac{(29-1)/4-1}{3}$.