***** NOT A TEACHER *****
You have asked a question that confuses many of us ordinary native speakers, too.
I found this explanation:
"Sometimes the past perfect is used ... with before or an equivalent word, to indicate an action which
should have preceded the action expressed in the main clause, but did not actually do so:
The manager came before I had read the report."
Source: Walter Kay Smart, English Review Grammar (Englewood Cliffs, New Jersey: Prentice-Hall, Inc., 1953), p. 170.