An aside, but the title sounds like the premise of Asimov's Foundation series. Highly recommended, I thoroughly enjoyed reading all three books.
When I read it as a teenager I guess I jumped straight into the sequel because I loved it so much. But then I had to read the related arc of the robot an then the prequel.
We miss you good doctor Asimov <3 (but you wrote so much there is still something old to rediscover)
Maybe humanity needs a real Foundation in these times.