One can use the past perfect with an indication of time. It depends on context and what you want to say.
Such as they stand, and without further context, I would not use the past perfect in either of your sentences.
But one can imagine contexts where the past perfect would be possible.
I had eaten an apple before I went to school, but I was still hungry when I got there/by the time I got there.
I had eaten an apple yesterday morning before I went to school, but I was still hungry when I got there.
In these sentence the past perfect is justified to describe an action (eating an apple) that precedes another action (going to school) in a past context. If nothing in the context specifies that you are talking about a situation in the past then the past perfect is not justified.
It would sound weird to say:
- I had eaten an apple before I went to school but I'm still hungry.
I'd rather use the simple past:
- I ate an apple before I went to school but I'm still hungry.
The past perfect expresses the idea that one action occurred before another action in the past.
Time indication is perfectly acceptable with the past perfect and could be an actual time of course:
- I had eaten an apple at half past seven before I went to school, but I was still hungry when I got there.
It's a bit complicated. And even though you can say that the basic use of the past perfect is to indicate an event that happened before another event in the past, it's not quite right to say that it's the only use.
Before touching that main point, let's take a look at your example sentence first.
In a general context, this sentence is more appropriate:
This tree was planted by the settlers who founded our city over four hundred years ago.
Was is in the past tense; founded is in the past tense. The past perfect is not needed because in this narrative, which is in the past tense, there is no need to indicate that the tree was planted before another event. However, context is king, and it can change everything. Consider:
Here is the town's monument. Besides the monument is an important tree. The monument was built in 1821. The tree had been planted by the settlers who founded our city over four hundred years ago.
Now we have a good reason to use the past perfect--to indicate that the tree was planted before the monument was built--i.e., it was planted before 1821 (it's unclear in what year it was planted, but it must have been at some point between over 400 years ago and 1821).
Back to your main point: is this (the past before past) the only use of the present perfect?
A straight answer is no.
Even though I don't have a complete list, and even though I don't want to touch more advanced subjects such as backshifting and narrative tenses (which don't imply time, strictly speaking; for example, a futuristic novel could be written entirely in past tenses), I can think of one good example: counterfactual conditional.
Here is an example sentence (taken from the Wikipedia page above):
If I had eaten more at breakfast, I would not have been hungry at 11am.
Though it's somewhat related to the idea of "an event that happened before another event in the past", it's not really the case, because in this case, it's "an even that hadn't happened before another event in the past". In other words, I didn't eat enough breakfast, so I was hungry at 11am.
Another point I'd like to make to wrap up this answer is, try to be flexible when learning English, think of those rules as guidelines rather than something set in stone, try to observe how people use these grammatical constructions in real life, and you'll be just fine. Happy learning! ;-)
Best Answer
There's nothing special about "ago" in particular. "Ago" just clarifies that the action took place in the past.
For example, the present perfect is equally incorrect in this sentence:
"Ago" is not used here, but the present perfect is still incorrect, because the eruption took place in the past.
So, don't get hung up on "ago". Either the simple past or the past perfect could be correct, but the rules for doing so are the same as the regular rules for using the simple past vs. the past perfect.