She thought John had loved her.

Literal

She [topic-は] John [subject-が] loved-for-her had-been [quotative-と] thought.

Two layers of past: the outer 思った ('thought') sets the reference frame, while the embedded 愛してくれていた gives the past continuous/perfect inside it — 'had been loving / had loved.' The benefactive ~てくれる anchors the love as directed inward toward her, making it personal rather than abstract; without ~てくれる, the sentence would read as a flat factual report. Japanese embedded clauses keep their own tense relative to their internal time, rather than backshifting to match the outer verb the way English routinely does.