It's a matter of the timeline. You use the different past tenses to position different events relative to one another in the past.
The sentence has these events in time, from earliest to latest:
- Stars are people's clock and calendar.
- People invent clock and calendar.
- Now.
The use of the word before allows some fluidity as to which tense goes where, and, indeed, whether you use the past perfect at all. You could simply say this (and if I were the writer's editor, I would suggest it):
Stars were people's clock and calendar before they invented either.
Due to the use of the word before, the simple past is sufficient to position the events in the proper order.
Your use of the past perfect tense is also correct (and perhaps more correct than the text). Past perfect for 1 positions it before 2, which is before 3.
But again, the use of the word before makes the use of the past perfect optional. The text conveys (probably without thinking it through much) the sense that clocks and calendars have been around for a long time. It implies this timeline:
- Stars are people's clock and calendar.
- People invent clock and calendar.
- Implied point in time long after clock and calendar were invented, and before now.
- Now.
Using the past perfect here suggests the point of reference of 3. You could also say this:
Stars had been people's clock and calendar [long] before they had invented either.
But all things considered, it's best to use the simple past for both verbs.
Where it becomes necessary to use the past perfect is when you don't specifically position one phrase before or after the other (by using either before or after), and need to do so. The past perfect positions its phrase before the phrase that uses the simple past. Consider this sentence:
Stars had been people's clock and calendar for thousands of years by the time they invented either of them.
While people would understand by context if you used were instead of had been, it is more correct to use the past perfect. (Here, also, you'll notice that we need to introduce a reference to a period of time.)