Example 7 Find all prime pairs $(p, q)$ such that $p q \mid\left(p^{p}+q^{q}+1\right)$.

Translate the above text into English, please keep the original text's line breaks and format, and output the translation result directly.
If $p=q$, then $p^{2} \nmid\left(2 p^{p}+1\right)$.
Without loss of generality, assume $p<q$.
If $p=2$, then
$$
2 q\left|\left(q^{q}+5\right) \Rightarrow q\right| 5 \Rightarrow q=5 \text {. }
$$

Therefore, $(p, q)=(2,5)$.
When $p$ and $q$ are both odd primes, we have
$$
\begin{array}{l}
p q \mid\left(p^{p}+q^{q}+1\right) \Rightarrow p^{p} \equiv-1(\bmod q) \\
\Rightarrow p^{2 p} \equiv 1(\bmod q) \Rightarrow \delta_{q}(p) \in\{2,2 p\} .
\end{array}
$$

If $\delta_{q}(p)=2$, then
$$
\begin{array}{l}
p^{2} \equiv 1(\bmod q) \Rightarrow p \equiv 1(\bmod q)(p<q) \\
\Rightarrow p=1,
\end{array}
$$

which is a contradiction.
Thus, $\delta_{q}(p)=2 p$.
By $p^{q-1} \equiv 1(\bmod q) \Rightarrow 2 p \mid(q-1)$
$$
\Rightarrow q \equiv 1(\bmod p) \text {. }
$$

But $0 \equiv p^{p}+q^{q}+1 \equiv 2(\bmod p)$, which is a contradiction.
In summary, $(p, q)=(2,5),(5,2)$.