Yes, this implies that $f$ is nilpotent.

As explained in my comment, $f(0)=0$ because otherwise Sarkovski's theorem would give us other periodic orbits which, of course, won't visit $x=0$. We also know that $f(x)<x$ for $x>0$.

Decompose the open set $\{x: f(x)>0\}=\bigcup I_n$ into its connected components. Clearly, since each set $[0,a]$ is invariant, the zeros of $f$ must accumulate at $0$. On the other hand, I claim that the $I_n$ do not accumulate at $x=0$.

Indeed, if they did, we could start out with any $I_0$ and then $f(\overline{I_0})=[0,b_0]$ for some $b_0>0$. By assumption, $I_1\subseteq [0,b_0]$ for some $I_1$. Let $K_1=\{x\in \overline{I_0}: f(x)\in \overline{I_1}\}$. Since $0\notin\overline{I_n}$ for all $n$, the orbit of any $x\in K_1$ will not yet have reached zero after one iteration.

Continue in this style: $f(\overline{I_1})=[0,b_1]\supseteq I_2$ for some $I_2$. Let $K_2 =\{x\in K_1: f^2(x)\in \overline{I_2}\}$. The compact sets $K_n$ are nested, so $\bigcap K_n\not=\emptyset$, but if $x\in K_n$, then $f^k(x)\not= 0$ for $k\le n$, so this point never reaches zero.

It follows that $f=0$ on $[0,d]$ for some $d>0$, but then everything is clear because now $f(x)\le x-\delta$ for some fixed $\delta>0$ for $x\ge d$, and each iteration brings us closer to the set $[0,d]$ by at least $\delta$.

6more comments