Do we really need $X$ to be compact Hausdorff?

I think you're right that the assumption $X$ is Hausdorff is unnecessary... all that matters is that the topology on $\mathbb R$ is enough to make points closed.

As for compactness, I think you are also right that it is unnecessary. Connectedness, the fact that $\mathbb R$ with the usual topology is $T_2$ (or even just $T_1$) and the continuity of the maps is all that's necessary to conclude there are only trivial idempotents.

And a VNR ring with trivial idempotents is a division ring, for exactly the reasons you gave.


Added:

Here's a screenshot of the solution from the companion book Exercises in classical ring theory

enter image description here

As you can see, the additional hypothesis that $X$ be compact and Hausdorff was used in the proof to appeal to the classification of maximal ideals of $C(X,\mathbb R)$. The theorem in question says that the maximal ideals are exactly of the form $M_c=\{f\mid f(c)=0\}$.

It looks like in this case, the author simply did not notice the elementary proof you have given above (that Hausdorff+connected+VNR implies field.)

Not sure exactly what the precise wording of the edition you're looking at is, but my guess is that it is aimed at using this same path to a solution.