You are referring to the Past Perfect. We can think of the Past Perfect as "the past of the pas". When you report the past simple and the present perfect, the report will be in the past perfect for both tenses.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.