I know that homology is most commonly introduced from a topological context (and/or Stokes theorem related context), but in say a homological algebra course/text, you are just given the definitions (chain complexes, the $d^2=0$ condition, and then the image over kernel construction) with very little/insufficient (in my eyes) motivation.
Of course it would be inconvenient to drag in all the historical motivation from topology, so I’m wondering if there’s a purely algebraic problem or question from which the ideas of (co)homology “obviously” arise, and if so, what’s the most natural or elementary such question.
For example a common intuition for homological algebra is that it “measures how far a chain complex is from being exact”, but even a student decently far along in their introductory algebra class (say having gone through group/ring/field theory and Galois theory and then developing module theory via “analogy from linear algebra”) does not know to care about chain complexes or measuring their exactness (or lack thereof).
I know that short exact sequences come quite naturally from the 1st isomorphism theorem, but I wonder if there are other algebraic “clues” that indicate that generally the $d^2=0$ condition and image over kernel construction are fruitful/key directions of investigation.
EDIT: it appears that a very similar question has been asked before, here How *should* we have known to invent homological algebra?. I would still be interested in answers to either!