Okay, my theory started off with the idea that she was a grand daughter of Emperor Palpatine. In the aftermath of the battle of Endor and the Emperor's death, perhaps even years later, the New Republic discover perhaps on some planet or system the Emperor had hidden, the living family of the Emperor. In this scenario the Republic wants to eliminate anyone having a claim to the "throne" so to speak. The family is killed and somehow Luke intervenes and saves the last remaining family member, which is Rey. Now the timing would mean this would take place many years after the fall of the Empire. While it could happen that way it would mean the New Republic was in the full swing of it's ascendancy, given Rey's age. For whatever reason I began feeling that was off.
I started ruminating a bit and have now added this into the mix...
Again let's go with the idea of Palpatine having heretofore unknown offspring. Again, let's assume that after the Battle Of Endor, very soon after, that the Republic/Alliance forces find them wherever they might have been hidden away. Let's assume that they feel the need to end the Emperor's line to stop any future "heir" from coming out of the woodwork later on. They kill the family members leaving one and again Luke intervenes. Only now the daughter is closer in age to Luke. This woman, shielded from her father's evil due to the need to be kept hidden is not a Force user, or perhaps is, in any case Luke and she end up falling in love. Perhaps Luke keeps her identity secret or making the same mistake his father did keeps the marriage hidden from public knowledge, maybe even confidants like his sister and Han. However it plays out they conceive a child. At some point, the mother is killed. Could be vengeful parties in the Republic, could be agents of the First Order in an attempt to capture her and the child so they would have a figurehead, an heir to Palpatine. Luke mourns his loss and realizes that this is what would follow his daughter all her life. She would be caught between the Republic and the First Order. Thus, he hides her away and hopes she can live a life of anonymity, as he realizes the raw power she could likely develop as she got older. Because... She is the true child destined to bring "balance". She is the heir to the legacy of the Jedi and the Sith as the daughter of both lineages. Luke's failures that haunt him then are two fold. He failed to see the turn of his nephew and he failed to see the consequences in falling in love and marrying the daughter of the Emperor. And now, it is up to Rey to pull him out of his exile. But Luke is wary because he doesn't know how the information that she is the heir to the Emperor will affect her, as he has seen what the legacy of Darth Vader and the Sith did to his nephew Ben.