Inspired by Eric Wofsey's answer, I'd like to add that one can completely answer the question which entire functions satisfy $f(z) = f(P(z))$ for any complex polynomial $P$. In most cases, only constant functions satisfy this, but there are two interesting exceptions.
In fact, unless $P$ is linear $P(z) = az +b$ with $|a|=1$, $f$ must be constant. That's trivial for constant $P$, and both for $\deg(P) \ge 2$ and for $P(z) =az+b$ with $|a| \neq 1$ the methods in the answers to Entire function $f$ such that $f(z)=f(P(z))$, where $P$ is a polynomial of degree at least $2$. show what we want. In fact, the argument with the maximum modulus principle can be applied far more generally to any function $h(z)$ instead of $P(z)$ for which there exists some domain $D$ with boundary $\partial D$ such that either $h$ maps some point of $\partial D$ inside $D$, or every point of $\partial D$ has a preimage under $h$ inside $D$. For the mentioned polynomials, it is easy to find disks which satisfy one or the other of these.
So now assume $P(z) =az+b$ with $|a|=1$.
In case $a=1$, we are asking about periodic entire functions $f(z) = f(z+b)$ with period $b\neq 0$ (otherwise the condition is empty). These are well-known to be in one-to-one correspondence with analytic functions $g$ on the punctured plane $\mathbb C \setminus \{0\}$, via defining $g(w) = f\left(\dfrac{b}{2\pi i}\log(w)\right)$; that is, with $g(w) = \sum_{n=-\infty}^\infty a_nw^n$, $f$ can be written as a Laurent series in $e^{\frac{2\pi i}{b}}$, $$f(z)=\sum_{n=-\infty}^\infty a_n e^{\frac{2\pi i}{b} n}$$
Compare e.g. Show this formula holds for an analytic, periodic function in each half plane or Periodic holomorphic function on the right half-plane or Entire "periodic" function and links from there about more statements to be made once one imposes growth conditions.
In case $a \neq 1$, but there is a (say minimal) $k$ with $a^k=1$, i.e. $a$ is a primitive $k$-th root of unity, the following interesting thing happens: $P(z)=az+b$ has the fixed point $p:= \frac{b}{1-a}$, and a quick calculation shows $$(P(z)-p) = a(z-p)$$
So if we develop $f$ into its Taylor Series around $p$, $f(z)=\sum_{n\ge 0} a_n(z-p)^n$, the condition $f(P(z))=f(z)$ becomes, via the identity principle for power series,
$$a_n=0 \text{ for all } n \not \equiv 0 \pmod k $$
Or in words, the power series around $p$ for $f(z)$ contains only terms where the exponent is a multiple of $k$. E.g. for $p=0$, $k=2$ these are the "even" functions $f(z)= f(-z)$.
Finally, in case $|a|=1\neq a$ and $a$ is not a unit root (i.e. of infinite multiplicative order), again $f$ must be constant, as can be seen by the exact argument as before (fixed point $p$, identity of power series) but now noting that $a^n \neq 1$ for all $n$ so all $a_n$ except $a_0$ have to be $0$.