Let $K$ be a field. It is easy to see that if the characteristic of $K$ is $0$ and $f(T)=\sum_{n\ge0}a_nT^n$ is a power series algebraic over $K(T)$, then $f'$ belongs to $K(T)(f)$. Indeed let $P(X)=\sum_{i=0}^lP_i(T)X^i$ be the minimal polynomial of $f$ over $K(T)$. By differentiating $P(f(T))$, one has $$Q(f(T))+f'(T)R(f(T))=0$$ with $Q(X)=\sum_{i=0}^lP_i'(T)X^i$ and $ R(X)=\sum_{i=1}^niP_i(T)X^{i1}$. Since $R(f(T))$ can not be zero (otherwise $R$ would vanish $f$ with a smaller degree than $P$) one has $$f'(T)=Q(f(T))/R(f(T))$$ But this proof does not work if the characteristic of $K$ is positive ($R(f(T))$ could be zero). So here is my question. Does $f'$ still belong to $K(T)(f)$ if the characteristic of $K$ is positive?
Let $p=\operatorname{char}(K)$.
By minimality of $P$, if $R(f(T))$ was zero, then $R(X)=0$. Thus, $p$ divides the degree of each nonzero coefficient of $P(X)$, so $P$ is not separable.
But the extension $K((T))/K(T)$ is separable, see: Why is $K_{\upsilon}K$ separable for a global field $K$?
So this situation cannot occur, and your argument goes through.

$\begingroup$ Thanks. I did not know this result. Do you know a reference for it? $\endgroup$ – joaopa Jun 23 at 18:10

$\begingroup$ I don't have a reference unfortunately, only remember reading it on here. $\endgroup$ – user277182 Jun 24 at 0:49