I have been reading about the Lebesgue differentiation theorem from Terence Tao's book and came across a bunch of things. In his book, Tao uses the Vitali Covering lemma (finite), Hardy-Littlewood maximal inequalities, and rising sun lemma to prove the Lebesgue differentiation theorem.
This answer gives a chronology of various proofs of the differentiation theorem. What I am interested in is the context under which the covering lemma, say appears.
Were Vitali, Riesz, Hardy and Littlewood developing their theorems and inequalities in order to prove the differentiation theorem, or do they fit in some larger picture?
I have seen the maximal function being used in the context of harmonic analysis, although I don't understand how. So, was Hardy working on harmonic analysis when he defined his maximal function?
In short, what were these mathematicians working on when they discovered the theorems above? Also, how do other covering lemmas (the infinite version or the Besicovitch covering theorem) fit into this picture?