I am interested in "invariants" of polynomials or rational functions (over $\mathbb C)$.
Consider for instance the polynomial $P(x)=x^3+1$. It has a a "symmetry" $r(x)=e^{2\pi i/3}x$, meaning that $P(r(x))=P(x)$. This means we can find an "invariant" function $i(x)=x^3$, having the property that $i(r(x))=i(x)$. Thus there is another polynomial $R$ such that $$P(x)=R(i(x)),$$ it is of course $R(x)=x+1$.
I am now interested in general in rational functions $Q$ that are "invariant" under another rational function $r$, i.e. $Q(r(x))=Q(x)$. Is there a general way to construct an invariant rational function $i$, such that $Q(x)=R(i(x))$ with $R$ another rational function?
Example: $$Q(x)=\frac{x(x^3+8)}{x^3-1}$$ satisfies $$Q\left(\frac{x+2}{x-1}\right)=Q(x).$$ Can we find an invariant function $i\left(\frac{x+2}{x-1}\right)=i(x)$ such that $Q(x)=R(i(x))$ with rational $R$?
My attempt: We can consider for instance $i(x)=x+\frac{x+2}{x-1}$ or $i(x)=x \frac{x+2}{x-1}$, and then by solving $i(x)=y$ for $x$ I find $Q(x)=R(i(x))$ with either $$R(x)=\frac{y^2-4}{y-1} \quad \text{or}\quad R(x)=\frac{y(y-4)}{y-1}. $$ These are clearly not the only possibilities: We could also consider $i(x)=\frac{x+2}{x-1}/x$, for which there doesn't exist a corresponding rational $R$.
My question: Is there a general theory of such "invariants" of rational functions, and how they can be systematically obtained?