Have you read anything about Carol Dweck's work on Mindset? You should. Everyone should. In short, it has to do with people's underlying beliefs of intelligence and learning. If you believe you're able to learn and to get smarter, you are more open to learning and more resilient in the face of failure/setbacks. It's the power of 'not yet'.
My kids ADHD/anxiety/LD sound a lot like yours. They engaged in a lot of negative self-talk (hell, my DH with ADHD still does!). After reading more about Dweck and mindset, I started making them repeat the mantra, 'whatever you practice, you get better at'. I also would talk to them about 'not yet'. I would also help them remember things that they didn't used to be good at but were now better because of practice. I even read to them parts of Dweck's book! If they said something negative about their sibling, I'd make them say 5 positive things and they couldn't be the same/repeats!
Anyway, when your DC engages in self-talk, I would acknowledge what must be their frustration, remind them their work may not be at the level they want but that they, as a person, are not their work. That we learn from our mistakes and that we get better with practice. My kids are older teens now and, I can tell you, it's really made a big difference.
https://www.mindsetworks.com/science/
https://www.amazon.com/Mindset-Psychology-Carol-S-Dweck-ebook/dp/B000FCKPHG/ref=sr_1_1?crid=22B24HEARPRBD&keywords=mindset+carol+s.+dweck&qid=1668790015&sprefix=mindset%2Caps%2C70&sr=8-1