The writers knew the direction each character was going and who they were at their core well before we as an audience could figure it out. One great example of this is the episode "Dooplegangland" in season three. In this episode, Willow as a vampire comes in from a different reality. When sending her back to her own reality, Willow says, " It's horrible. That's me as a vampire? I mean, I'm so evil, and skanky.. and I think I'm kind of gay." Willow doesn't actually come out til almost the end of the fourth season, and at this time she was still very much with Oz. As an audience member I would have never guessed that this was actually foreshadowing of what was to come.
This is the same thing that books like Harry Potter do so well. JK Rowling is famously known to have planned out the entire series on day on a long train ride. I think it is really a sign of true quality, that writers aren't just making things up as they go along but have a real focused goal. If Buffy didn't have this interconnected aspect to it, I doubt it would be studied at all.