Even if he had it "written" is his head, it makes you wonder how much of a backstory he tied to each character.
Darth Vader - Luke's father, once a jedi, turned to the dark side
Obi-Wan - darth's good pal when he was good
Leia - daughter of darth
Luke - son of darth
There I have created a backstory for them

The keys words are "basic storyline"
My point was intended to be that when he made the first movie he did not have the final story in place. I believe the Star Wars phenomenon grew so much that he ran with it, that's all. In the process of running with it he had to make decisions and tie in the past to make his original story more accurate.