So, unsurprisingly, John Williams knew it all along. I recall some drawing similarities between the melodies of Rey and the Emperor, and of course that turned out to be 100% apt. The musical parallels between the two themes are absolutely striking. The intro to Rey's theme and the Emperor's main theme matches melodically.
Correlation is not causation, it's also possible that JW was using a lite motif that broadly referenced "dark side" attributes and used that melodic snippet to imply the struggle of Rey.
JJ Abrams said they did not decide to make Rey a Palpatine until late in the stages of writing Ep 9. So Williams did not know anything in 2015 for Ep 7.
In 2016, Williams gave an interview where he said he believed Rey was a Skywalker, saying: "I never asked J.J. Abrams who Rey’s father is, but I think it’s Luke Skywalker. Your guess is as good as mine, though." So no, any resemblance between her theme and the Emperor's is not intentional.
The "resemblances",if there are any, are definitely not intentional. And I must say, musically, both themes are completely different, using different compositional techniques. Rey's theme is (musically) much closer to the Force theme, for example: Williams even brings the two themes together in the end credits of VII.
The Palpatine/Rey theme similarity is a happy coincidence - I remember in theaters, shortly after the plot twist was revealed, there was a scene in which Rey's theme was being played, and I legit thought it was Palpatine's for a moment. Worked out brilliantly, but as I said, a coincidence That said - this video does an excellent analysis on the themes of Palpatine, Rey, and Kylo, and I might believe the bit about the Kylo Ren letimotif being a sort of "extension" of Palpatine's, though of course, that could also be coincidental
The way Rey uses her lightsaber in a moment during her duel with Kylo always reminded me of how Palpatine used his in ROTS. Still, I think it's fairly obvious Rey was decided to be a Palpatine after TLJ was done. On another note, I must say, despite my apathy for the sequels, Rey's theme is absolutely tremendous. It's even nostalgic for me. Reminds me of her scenes on Jakku.
The key to humor is........ ......... ...... ......... ........ ...... .......... ....... ......... ......... ........... ............ ....... ....... ........... ........... ............ ......... ......... ....... ........ ..... ................. ......... ........... ...... ......... ....... timing!