Most people aren’t aware of this, but there was a cancelled novel called ‘Supernatural Encounters: The Transformation & Trial of Arhul Hextrophon’ which more closely details the origins of the Star Wars universe. It was cancelled largely due to a dispute over licensing with LucasArts, but it’s the closest we’ll get in Legends material to explaining the background of things.
With that in mind, I found their explanation for the true origins of the Rakata quite interesting (the whole book is in online PDF format for free). According to this, a number of species were created by beings called the Bedlam Spirits who in turn were created by a Celestial named Wutzek, who was a rival of the Mortis trinity (the Father, Son, and Daughter from the Clone Wars). One of the spirits he created was named Tilotny and she and her siblings created a number of the known species by twisting the 80 or so species initially created by the Celestials and experimenting on them to create abominations of all sorts, including some new sentient species, to use to fight both each other and the Celestials in order to secure their domination of the galaxy. She created the Rakata by abducting Ongree from their homeworld of Skustell as well as Gungans from Lehon (yes, Lehon a.k.a. Rakata Prime was the actual original homeworld of the Gungans according to this book). She unleashed the Rakata on Lehon and then massacred the Gungans who it turns out were helped by the Kumumgah (the ancient ancestors of the Sand People and Jawas who were technologically advanced) of Tatooine who rescued them (presumably aided by portals and/or Force-powered ships given by the Celestials) and resettled them on Naboo.
The Rakata were fiercely loyal to Tilotny and spread across Lehon making it their home and their descendants came to worship her as the goddess Onrai in their religion. They also were originally three sub-species called the Ikalik (red-skinned, lived in the forest and glades), the Groot (blue-skinned, lived in the tidal coves), and Bukesek (black/gray-skinned, lived in the volcanic and/or sandy areas) but there was much intermarriage as the tribes eventually united into one people again through conquest. At some point the reptilian Kwa or Kwoth species came to Lehon and educated the Rakata in the Force but the Rakata used them and their technological knowledge for evil and eventually united and drove the Kwa to extinction, basically taking over much of their former holdings across the galaxy. They invented Force-powered hyperdrives and conquered much of the galaxy, the rest is history in Legends. So yeah, the Rakata are related to the Gungans and Rakata Prime was the original Gungan homeworld. This was interesting.
Please share your thoughts, and a link to the page on the book in PDF where this is mentioned is included here: Supernatural Encounters. : Joseph Bongiorno : Free Download, Borrow, and Streaming : Internet Archive