The past perfect is used to relate two events that happened in the past. The actual time frame is not important. If you don't need to relate two events, then it's generally preferable to use the simple past. Some examples:
- I learned our ancestors lived in Africa.
- I learned our ancestors had lived in Africa before migrating to almost every habitable corner of the planet.
- Legend says that the prophetess Cassandra foresaw the destruction of Troy. Unfortunately, everyone thought her mad and didn't believe her.
- Legend says that the prophetess Cassandra had foreseen the destruction of Troy years before the city actually was conquered. Unfortunately, everyone thought her mad and didn't believe her.
I'm not certain that "before" plays any significant role here. The past perfect is generally optional, regardless of which adverb you use to relate the sentences:
I went to sleep after I had finished all my homework
I went to sleep after I finished all my homework.
I could not pay him because my wallet had been stolen
I could not pay him because my wallet was stolen.
and so on. Note I say generally optional, but not always. For example:
By the time Alex finished his studies, he had lived in London for over eight years.
Here the simple past (he lived) doesn't really work, since the sentence wants to express a definite relationship between the events. Although here I think the past perfect progressive works better, since it emphasizes an action just completed:
By the time Alex finished his studies, he had been living in London for over eight years.