Gently, I would encourage you to not view it as "The friend decided that DD was expendable and cut her loose." They are 5. Most of these kids barely know which shoe goes on which foot. I don't think this child likely really decided anything...she maybe just felt like doing something else that day, or was feeling like playing on the swings and your DD didn't, or...
I'll second ultra on this - I doubt there was serious intent on the part of the other girl either to be your dd's best friend or to ignore her for the rest of the school year. I have two dds who are now several years past kindergarten, both with different personalities - one is extremely social and is friends with everyone, the other is more of a few-close-friends type kid. When they were kindy, the majority of girls we knew (including my dds) were not putting thought and planning into relationships with other kids at school - at recess etc they were falling into play with whoever happened to be doing what they wanted to do that day. My ds, who is EG and 2e, had a tougher time with playground situations had a tough time with recess and didn't have many friends through most of early elementary (he had two close friendships develop in kindergarten but they weren't "close" the way my dds close friendships have been), and as our kids got older, those two friends started branching out and making other friends and my ds seemed to have a tough time navigating what I thought should be typical development re making new friends etc. In hindsight, I started realizing it had less to do with his giftedness and being out-of-sync re intelligence than it was related to his overall anxiety over school - which was related in a huge way to the challenge half of his "2e". Once we were able to get him into a classroom situation where he wasn't constantly under stress and once we were able to get him accommodations so that he wasn't always comparing his inability to others abilities... his anxiety went away and he was able to fit in much easier at recess etc. Now that he's in middle school and not only has a less stressful classroom situation (due to accommodations etc) he also has a much more mature self-awareness which helps him understand and navigate his challenges in a way that works much better than having to rely on parents and teachers to always have to be thinking ahead or putting out brushfires to navigate the world of the challenge part of his "e"... and he's now navigating social situations and making friends the way most neurotypical kids do.
My dd and your ds are, of course, two completely different kids - but as um mentioned, what you describe sounds like anxiety. Eventually you will get to the root cause of the anxiety, and figure out whether or not the anxiety is secondary to some other something in your dd's life or if it's primary - whichever, you'll find a way to lessen the stressors that feed it, and in turn she will hopefully have less struggles with classroom/playground/etc friendships.
FWIW, I think this type of thing is really common in kindergarten, particularly at the start of the school year. My kids' K-1 teachers all did one thing in the classroom that I think helped all the kids - they switched classroom seating around every few weeks, they purposely paired/grouped different sets of kids together on each different project that they did, and they made a point of being inclusive of everyone. That doesn't help directly on the playground when the teacher isn't there organizing play, but over time I felt it really helped our kids' classmates make friends with each other and not just pair off into small sets of friends.
Best wishes,
polarbear