I read this question, but I want to prove that if $f$ is analytic on a connected open set $U$ (not just $f$ entire) with the property that for all $z\in U$ there is natural number $n$ (depending on $z$) such that $f^{(n)}(z)=0 $, then $f$ is a polynomial. The argument should be almost identical but I need to make sure the proof is still sound.
Let $$S_n = \{z: f^{(n)}(z)=0 \}$$
Then if some $S_n$ is uncountable, we should have that $f$ is a polynomial, since $S_n$ has an accumulation point that lies in $U$ So $f^{(n)}$ has a non-isolated zero. Then by the identity theorem $f^{(n)}(z):=0$ on $U$ and $f$ is a polynomial with degree less than $n$. The existence of an uncountable $S_n$ follows from $U=\cup_{n\in \mathbb{N}} S_n$.
I am a bit unsure about the bolded text. I know by Bolzano Weierstrass that there is an accumulation point, but how can I ensure it is in $U$? It seems like it should be true but I should prove it. Otherwise, is the proof complete?