Recall that $[X,K(G,n)]=H^n(X;G)$. Hence $[K(\pi,n),K(\rho,n)]=H^n(K(\pi,n);\rho)$ — which (by Hurewicz theorem + universal coefficients) is exactly $\hom(\pi,\rho)$.
If you want to replace homotopy classes of maps out with homotopy classes of maps in, what you get is homotopy, not homology. This is part of the yoga of Eckmann-Hilton duality. Because it's a "maps-in" construction, homotopy behaves well with respect to homotopy limits (e.g. the long exact sequence of a fibration). Both homology and cohomology, on the other hand, behave well with respect to homotopy colimits (e.g. the Mayer-Vietoris sequence).
The categorical way to think about homology is to think of it as coming from a higher analogue of taking the free abelian group on a set (rather than taking either functions in or out of the set). There are a number of ways to make this precise, such as the Dold-Kan theorem and the Dold-Thom theorem, as well as the more abstract approach involving spectra, which are the higher analogues of abelian groups.
You can think of taking the free abelian group as a "tensor product" operation $\mathbb{Z} \otimes X$, which among other things gives you the right expectations as to its behavior with respect to limits and colimits (it preserves colimits in the $X$ variable). The way this generalizes to spectra is that if $E$ is a spectrum, then $E$-homology is the homotopy groups of the "derived tensor product" $E \otimes X$ (formally, the smash product of $E$ with the suspension spectrum $\Sigma^{\infty}_{+} X$, which you should think of as the free spectrum on $X$). If $E$ is a ring spectrum, this can be thought of as the free $E$-module spectrum on $X$.
It might help to organize everything into the following table, which also includes the analogous operations in homological algebra:
Homotopy | Ext(A, -) | Maps in | Covariant | Preserves limits
Homology | Tor(A, -) | Tensor | Covariant | Preserves colimits
Cohomology | Ext(-, A) | Maps out | Contravariant | Sends colimits to limits
(I should clarify that the statements in the last column aren't literally true as written; first, limits and colimits should be replaced by homotopy limits and colimits, and second, depending on whether you take homotopy groups or not "preserves" should be replaced by the existence of a nice spectral sequence.)
Best Answer
If $G$ is a topological group, then there is a universal principal $G$-bundle $EG \to BG$ where $EG$ is weakly contractible. Using the long exact sequence in homotopy, we see that
$$\dots \to \pi_{i+1}(EG) \to \pi_{i+1}(BG) \to \pi_i(G) \to \pi_i(EG) \to \dots$$
As $EG$ is weakly contractible, $\pi_{i+1}(EG) = 0$ and $\pi_i(EG) = 0$, so $\pi_{i+1}(BG) = \pi_i(G)$.
Now, if $BG$ is a topological group (which happens if and only if $G$ is an $E_2$ space), then the above argument shows that $\pi_{i+2}(B^2G) = \pi_{i+2}(B(BG)) = \pi_{i+1}(BG) = \pi_i(G)$.
In general, if $G$ is an $E_k$ space, then $B^kG$ is defined and satisfies $\pi_{i+k}(B^kG) = \pi_i(G)$.
If $G$ is a discrete group, then $\pi_0(G) = G$ and $\pi_i(G) = 0$ for $i > 0$, so $\pi_k(B^kG) = G$ and $\pi_i(B^kG) = 0$ for $i \neq k$. Therefore $B^kG$ is an Eilenberg-MacLane space $K(G, n)$.