OP,
I think a neuropsychological evaluation. If these behaviors are ongoing and affecting him at school, then the public school may agree to test him. See the Wrights Law website for how to initiate the IEP process:
http://wrightslaw.com
You can use a private tester; usually it's not covered by insurance, but check with yours. KKI or Children's are also possibilities for testing and are often covered by insurance at these places.
Your son could probably benefit from a social skill group or class that emphasizes flexible thinking. We did the one at Ivymount, which was expensive, but it came with a concurrent parent class that I found invaluable. You can read the book:
https://www.amazon.com/Solving-Executive-Function-Challenges-Unstuck/dp/1598576038/ref=sr_1_2?s=books&ie=UTF8&qid=1481135690&sr=1-2&keywords=unstuck+and+on+target
The research was done with kids on the spectrum, however kids with anxiety, ADHD, executive functioning issues can "get stuck" in their thinking as well. The techniques can be used pretty much any kid. In essence how to make a plan B and move on from the initial disappointment/disagreement.
If your son does have ADHD or anxiety, medications might help him regulate his mood, so he's more receptive to working on these skills.