Why is every meromorphic function on $\hat{\mathbb{C}}$ a rational function?
The exponential function has an essential singularity at $\infty$, but is meromorphic everywhere else -- and is not rational.
On the other hand, if the singularity at $\infty$ is removable, then the proof you sketch still works, and shows that $f$ must be a rational function.