Friendships and the 8-10-year-old boy?

I've been thinking a lot about the way friendships seem to be playing out in the third and fourth grades for boys.

Note: I'm not trying to exclude girls, and I don't know if things are substantively different for girls, but I don't have any girls to observe close-up. So this is about boys but not not about girls, if that makes sense. I'd appreciate data points about girls in the comments.

In these grades it's felt like the boys are constantly shifting friendships and alliances. Like two boys will be best friends one day, and then the next they will be enemies and will be friends with boys they didn't like the day before.

It makes arranging playdates difficult, since a playdate arranged too far in advance can fall apart if the boys are on the outs that day. It makes planning birthday parties difficult, too, since it's not just about who your son wants to come to his party, but whether those boys are friends on the day of the party.

I have found it all to be very hurtful to my son at the same time that I'm sure he's hurting other kids' feelings, but they don't seem to know how to stop.

Is this a testosterone surge? There has to be some sort of explanation for it, because it seemed very timebound, and seems to be starting to stabilize as the boys all turn 10.

Has anyone else experienced this? What do you think causes it? Is there something we could be doing differently to help the boys get along better?