I just started learning ergodic theorem due to the need in a research project. I am aware of the following form of ergodic theorem:
If $\{X_n\}$ is an ergodic process with state space $\mathcal{X}$ and stationary distribution $\pi$, then for any function $f(\cdot)$ such that $\mathbb{E}_{\pi}[f(X)]<\infty$ then $$\lim_{n\rightarrow\infty} \frac{1}{n}\sum_{i=1}^{n}f(X_i) = \mathbb{E}_{\pi}[f(X)],\quad a.s.$$
Is the following claim true? If $\mathbb{E}_{\pi,\pi}[g(X,X)]<\infty$, $\mathbb{E}_{\pi}[g(x,X)]<\infty$, and $\mathbb{E}_{\pi}[g(X,x)]<\infty$ for all $x\in\mathcal{X}$, then $$\lim_{n\rightarrow\infty} \frac{1}{n}\sum_{i=1}^{n}g(X_i,X_n) = \mathbb{E}_{\pi,\pi}[g(X,X)], \quad a.s. $$
My first attempt is to first replace $X_n$ with a fixed $x$, then using the known ergodic theorem I have $$\lim_{n\rightarrow\infty} \frac{1}{n}\sum_{i=1}^{n}g(X_i,x) = \mathbb{E}_{\pi}[g(X,x)],\quad a.s.$$ Then replace the fixed $x$ with a random variable $X_{\infty}$, whose distribution is $\pi$. Then I get the desired conclusion.
But the above attempt is not rigorous, especially the second step. The result seems to be intuitive but I am not sure how to prove it.
Any help is highly appreciated! Thank in advance.