Demerzel can’t die, so even if the galaxy dies, she will live somewhere, and she has the tech of cloning humans. Gaal has her daughter’s zygote on a beggar. Since there is a high chance, she might die because of the mule despite winning against him.
So what are the chances she becomes Kalle later?
We know she can pass on her consciousness to another’s body. A zygote is a potential body as long as it lives, right...? So maybe at the end of season 3, Demerzel helps Gaal. She combines her cloning tech, the healing tracking nanites, to make the zygote survive post-galaxy fall with Gaal’s consciousness in it, as well as all her robotic data. Since we know Gaal will orbit a black hole in a few months, her body possibly will be remade like Hari’s was after he was killed in S1. Gaal may surpass the spacers and Hari thanks to the black hole’s influence and prolonged exposure and be born as Gaal 2.0 and call herself Kalle.
Something-something human brain and organic neurological matter being the best databank applies here, I learnt recently, all thanks to Murderbot.
Also, there is the thing about Kalle’s maths being musical; music is also a frequency and a form of memory that can be passed down, modified and codified according to the individual. A music which Gaal inherently knows despite not being aware of it, and that’s how maybe she solved the maths in season 1 because she can bend time as Kalle in the future and use mathematical music to transcend time and space...
P.S.: I haven't read the books yet. I want to enjoy the series first and pick them up later.