Way back in the early stages of Star Wars, when George Lucas was still tinkering with the first drafts, he referenced something called "The Journal of the Whills." It was basically supposed to be a fictional history of what would become the Star Wars galaxy, as if all of the stories of the universe were told secondhand and collected.
The story of the Skywalkers, according to Lucas, was meant to be narrated by R2-D2. io9 pulled this neat bit from Chris Taylor's book How Star Wars Conquered the Universe, which has the author recounting a quote from Star Wars animation director Rob Coleman during his time on the set of Revenge of the Sith:
The entire story of Star Wars is actually being recounted to the keeper of the Journal of the Whills—remember that?—a hundred years after the events of Return of the Jedi by none other than R2-D2.
This actually answers a lot of lingering questions that have plagued fans for years — namely, why Artoo's memory wasn't wiped along with C-3PO's at the end of Sith. It also makes sense, considering Lucas has always maintained that the movies are told from the droid's point of view; they're the connective tissue that ties all of the characters and situations together.
Plus, as io9 points out, Taylor theorizes that Artoo being the narrator jives with how flawless and heroic the little droid is — he saves our heroes time and time again, always getting them out of tight spots. He even gets blasted during the Death Star attack in A New Hope and survives.
So basically, R2-D2 is a messianic figure. The Ewoks were worshipping the wrong droid.