I can relate to that, I had a tough time too in training. But looking back on it. It was mostly in the head. I was my own worst enemy. Trying too hard. In part it was because I tried to maximise the training benefit from each flight because it was costing me a fortune. When I failed to make progress it made it worse. My Instructors were frustrated by my inconsistency and the doubts flooded in. I almost deliberately induced mistakes.
But once I learned to relax, it tended to fall into place. Also I changed Instructor. The other Instructor was excellent but I couldn't relax properly with him.
The problem with self doubt is that it reinforces itself. If you expect to fail, you will. Like I said it's as if you deliberately induce mistakes.
In the end I got through it. Once I was offered my first paid flying job. The doubts were still there. Clearly they had made a mistake. But strangely enough they hadn't. Leaving aside all modesty. I turns out I'm actually a damm good pilot and people have told me so based on their experience of other pilots. They didn't need to. I have become a typical pilot, with a gigantic albeit delicate ego.
In part, I believe the reason is at least in part because I struggled a bit and had to work harder to achieve a good standard. So it's well and truly imprinted on my brain. I've come across super confident pilots who obviously sailed through their training. Trouble was some of them couldn't even get the basics right. They must have had them at one stage but lost the skills without being aware. Basic things like maintaining straight and level flight or not climbing with stall warning blaring. Incredible but true.
My advice is to forget the negativity, try and relax but keep the concentration up. Work at it. If you make a mistake correct it and forget it. If you dwell on mistakes you'll repeat them or make new ones. Make sure you're comfortable with your Instructor. Start afresh, forget all the bad stuff and move on.