Can the composition of a rational function ever be a polynomial? Suppose we have a function $f(x) = \frac{h(x)}{p(x)}$ where $h(x)$ and $p(x)$ are polynomials. Can any iterative composition of $f(x)$ like $f(f(x))$ or $f(f(\dots f(x)\dots)$ be a polynomial?
Update
Let me add a few more constraints. $\deg(p(x)),\deg(h(x)) \geq 1$ and $p(x) \nmid h(x)$
Furthermore if $\dfrac{h(x)}{p(x)}$ can be reduced, then neither the numerator nor the denominator is ever a constant, i.e the degrees of the numerator and denominator are always greater than or equal to $1$

There are nontrivial examples of degree $1$.  Composition of rational functions of the form $\frac{ax+b}{cx+d}$ coincides with multiplication of the corresponding matrices $\begin{pmatrix}a & b \\ c & d\end{pmatrix}$.  So, if you take any matrix $\begin{pmatrix}a & b \\ c & d\end{pmatrix}$ which has a power which is upper triangular (which actually implies the power is diagonal unless the original matrix was already upper triangular), the corresponding power of the function $f(x)=\frac{ax+b}{cx+d}$ is a polynomial.  For instance, $$f(x)=\frac{\cos(\theta)x-\sin(\theta)}{\sin(\theta)x+\cos(\theta)}$$ satisfies $f^n(x)=x$ if $n\theta$ is a multiple of $2\pi$.
In higher degrees, there are the trivial examples $f(x)=\frac{1}{x^d}$.  Slightly less trivially, there are also examples $f(x)=\frac{a}{(x-b)^d}+b$ which are obtained by conjugating $\frac{1}{x^d}$ by a linear polynomial.  However, these are the only examples.  More precisely, if $k$ is a field of characteristic $0$ and $f\in k(x)$ is a rational function of degree $d>1$ such that $f^n$ is a polynomial for some $n>0$, then either $f$ is a polynomial or $f(x)=\frac{a}{(x-b)^d}+b$ for some $a,b\in k$.
To prove this, we may assume $k$ is algebraically closed and consider $f$ as a mapping from the projective line $\mathbb{P}^1_k$ to itself, where each point has exactly $d$ preimages counted with multiplicity.  To say that $f^n$ is a polynomial means that $f^{-n}(\{\infty\})=\{\infty\}$, so that $f^n$ maps $\infty$ to itself with multiplicity $\deg f^n=d^n$.  Now observe that if $f$ maps $\infty$ to a point $p\in\mathbb{P}^1_k$ with multiplicity $u$ and $f^{n-1}$ maps $p$ to $\infty$ with multiplicity $v$, then $f$ maps $\infty$ to $\infty$ with multiplicity $uv$.  Since $u\leq \deg f=d$ and $v\leq \deg f^{n-1}=d^{n-1}$ but $uv=d^n$, we must have $u=d$ and $v=d^{n-1}$.
Thus $f$ maps $\infty$ to $p=f(\infty)$ with multiplicity $d$.  Similar reasoning (decomposing $f^n=f\circ f^{n-1}$) shows that $f$ maps $q=f^{n-1}(\infty)$ to $\infty$ with multiplicity $d$.  If $p=\infty$, then $f$ maps $\infty$ to itself with multiplicity $d$ and therefore is a polynomial.  Otherwise, we can conjugate $f$ by a translation to assume that $p=0$, so $\infty$ is a zero of $f$ of multiplicity $d$.  This means the numerator of $f$ is a constant.  On the other hand, $q$ is a pole of $f$ of multiplicity $d$, so the denominator of $f(x)$ is $(x-q)^d$.  Thus $f$ has the form $f(x)=\frac{a}{(x-q)^d}$ for some nonzero $a\in k$.
Now note that similar reasoning as above shows that $f$ must map $f(\infty)=0$ to $f(f(\infty))=f(0)$ with multiplicity $d$.  But now observe that $f'(x)=\frac{-ad}{(x-q)^{d+1}}$ vanishes only at $\infty$, so since $d>1$ it is impossible for $f$ to have multiplicity $d$ at $0$ unless it has a pole there, i.e. unless $q=0$.  Thus $f(x)=\frac{a}{x^d}$ has the desired form.
(If $k$ has characteristic $p>0$ and $d$ is divisible by $p$, then $f'(x)$ will be identically $0$ so we cannot conclude $q=0$ as above.  So in that case, we can only say $f$ has the form $f(x)=\frac{a}{(x-b)^d}+c$ where $b$ and $c$ may be different.  Note, for instance, that if $k$ has characteristic $2$, then $f(x)=\frac{1}{(x+1)^2}$ satisfies $f^3(x)=x^8$.  I have not checked whether $f(x)=\frac{a}{(x-b)^d}+c$ works for arbitrary $b$ and $c$ (or equivalently, that $f(x)=\frac{a}{(x-q)^d}$ works for arbitrary $q$) whenever $d$ is divisible by the characteristic.)
