If $S$ is a closed hyperbolic surface, is there an easy proof of the injectivity of the Dehn-Nielsen-Baer map from $\mathrm{Mod}(S)$ to $\mathrm{Out}(\pi_1(S))$, taking an element of the mapping class group to the induced outer automorphism of $\pi_1$?

I naturally looked in Farb-Margalit’s *Primer on Mapping Class Groups* for something like this. But I do not understand their argument. They appear to assert (Chapter 8, p. 220) that since $S$ is a $K(\pi,1)$, there is a bijection between homotopy classes of continuous maps from $S$ to itself and homomorphisms from $\pi_1(S)$ to itself, up to homotopy.

I do not understand why this should be true. There is a common belief that if two maps between CW complexes induce the same map on all homotopy groups, then they are homotopic; this is false. See, eg, here: Maps inducing zero on homotopy groups but are not null-homotopic . But maybe something like this is true for homotopy equivalences?

I do find it asserted several other places that if a manifold $M$ is a $K(\pi,1)$, then its homotopy mapping class group is the same as $\mathrm{Out}(\pi_1(M))$, for instance: