In the "Key to Time" season of Doctor in 1978–1979, the Doctor twice encounters agents of the Black Guardian, the evil primordial evil entity being that is seeking the Key. I have, over the years, often been puzzled about the precise plans of the Black Guardian and his agents, and an earlier question I asked that is somewhat related to this one can be found here: Was the White Guardian involved in the Key to TIme at all?.)
In "The Stones of Blood," the Doctor and Romana receive a warning at the beginning of the first episode to, "Beware of the Black Guardian," and they eventually find that the third segment is already in the possession of the villainess Cessair of Diplos. In "The Armageddon Factor," the protagonists find the Shadow, a minion of evil who has apparently been waiting for them to deliver the first five segments to him. Eventually, once the entire Key is collected, the Black Guardian even tries to get the Doctor to hand over the Key himself.
When we first watched the stories, it struck me as a absurd coincidence that the third segment of the Key was located on Earth. The Doctor delightedly tells Romana that she is going to get to see his favorite planet—which, as Romana says everyone knows, is Earth.
Later, after seeing the whole season, I realized that there was an extremely logical reason that the Key segment was located on Earth—and had apparently been located there since Celtic times. If the Black Guardian is actually hoping to have the Doctor assemble the segments, it would make sense to have one of his minions steal the a segment and bring it to Earth (well known to be the Doctor's favorite world) for the Doctor to pick up later. Cessair does not apparently know that she is supposed to lose the segment to the Doctor, although she does know something of its powers (having harnessed them to change her appearance), and she also knows that the Doctor is present on Earth seeking the segment. Watching the stories again, knowing what will happen at the end of the season, makes the Earth setting a bit of ominous foreshadowing.
But was this really intended? Is there documentation that the key permanent staff for the series—producer Graham Williams and script editor Anthony Read—were really intending this level of subtle foreshadowing?
At least one other piece of information seems to suggest otherwise. There were apparently also plans to have another show that season also take place on Earth, (to be called "The Shield of Zarak" or "The Shield of Time"), but it fell through when scriptwriter Ted Lewis was unable to complete the job. (This explains some of the slapdash peculiarities of the quickly-assembled replacement story, "The Power of Kroll"—such as the script being the second one of season written by former script editor Robert Holmes, the the extremely short episode running times, special effects problems, and the use of K-9's voice actor John Leeson and the stunt coordinator Terry Walsh in regular roles.)
Of course, the producers and script editors for the show were sometimes known to make changes to individual episodes to make them much better fits to the show's ongoing plot lines. For example, a few years later, the Fifth Doctor story "Enlightenment" started out having nothing to do with the Black and White Guardians, but the Eric Seward turned the climax of Barbara Clegg's lackluster script into a near perfect resolution of Turlough's early plot arc. (Turlough was promised the thing he wanted most, and he got it: He got the chance to make a fully informed decision whether he wanted to turn Doctor over to the Black Guardian in return for whatever rewards the Guardian could offer him, or whether he wanted to side with the Doctor.) So it is possible that, having commissioned "The Stones of Blood," a story taking place on Earth, they may have made changes to include this foreshadowing of what would happen in the season finale.