Your DD’s innate ability and interest in maths is still there. Nothing fundamental has changed just because she isn’t moving to the first set.
I’m glad that you’ve been able to find out that she almost made it. It means that moving up in the future is a realistic goal if that’s important to her.
If the school gives the top set the chance to do Further Maths in the GCSE years, for example, or if there are other enrichment activities only available to the top set, I can see that it’s not just about the kudos of being in the ‘premier division’. It doesn’t sound as if the end of Y9 would be too late for moving up from a practical perspective in your DD’s school, though the end of Y10 might be, and certainly would be at my DS’s school.
Your DD did very well in the most recent exam and her teacher clearly thinks she has an aptitude for maths. If she wants to do even better, it might be helpful to find out if she is losing marks because of gaps in her knowledge, silly slips in questions she knows how to do in principle or if she runs out of time.
I do feel for you and your DD. My DS ended up doing Y9 in the second set having always been in top sets and it gave me a pang, I’ll admit, because, like your DD, he’d struggled a bit with essay-based topics and maths had always been his thing. (Luckily he wasn’t too bothered himself!) He was ‘demoted’ with a handful of others, most of whom did very well being at the top end of the second set and actually better than the majority of those in the top set in the Y9 end of year exam - most made it back into the top set. Going into the second set doesn’t have to be a one way ticket.
You mention that your DD has some learning differences. One of the ‘demoted’ boys in my DS’s class was eventually given extra time in exams so he could do himself justice. If you think your DD might qualify for more time in exams, this might be an avenue worth pursuing, especially with GCSEs on the horizon.
I don’t think it’s that unusual for innate ability to be obscured by learning differences when it comes to timed tests. My favourite classroom underachiever is Roger Penrose, the theoretical physicist. When he was in primary school, he was put down a class because he was slow on timed arithmetic tests. Later on, a teacher recognised he had potential, allowed him more time and he did well.
You can read about his early experiences towards the end of this interview if you are interested.
I hope your DD will continue to enjoy maths next year and tell her not to lose heart! She doesn’t have to be the best at maths exams. She only needs to play the game to the extent that she does well enough to ensure any avenues she wishes to go down remain open to her.