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.)