This problem is addressed in A Comprehensive Grammar of the English Language [Randolph Quirk et al. 1985, p 1020]:
The use of the past perfective in before-constructions requires
special consideration.
These four sentences seem to be equivalent in meaning:
I saw him before he saw me.
I had seen him before he saw me.
13. I saw him before he had seen me.
- I had seen him before he had seen me.
Sentence 13 appears to be paradoxical in that the second in the
succession of events is marked with the past perfective, contrary to
what we have noted above in the after- and when-clauses. One
explanation is that the before-clause in 13, and perhaps also in 14,
may be nonfactual; that is to say, the event in the before-clause may
not have taken place ('He did not get a chance to see me, because I
evaded him').