Poor confidence and low self-esteem in your partner are going to significantly complicate matters, and the guiding idea of my answer here is that you are going to have to account for those traits. A person with more confidence and better self-esteem would be able to weather small hiccups (like an awkward position, or an experiment that doesn't quite work).This is not the case here, and a solution like having a safeword may not be enough because it still requires your partner to cope with missteps, but doesn't really aid them in doing so.
Consider: from your description, there wasn't any confusion as to whether or not you enjoyed that particular thing-- you both knew that it wasn't working. The problem (according to my reading of the situation; you know this person better than I do) is that your partner doesn't handle missteps well. The problem seems more like they thought
Anilla didn't like it, I'm bad at sex. I don't know how to do it, and I am incapable of doing a good job, as evidenced by Anilla not liking that thing that I tried.
than the idea suggested by the question, which seems to me to be more like
I can't tell if Anilla likes the things I try or not. I would really like better communication so that I can confidently be moving towards doing more of what Anilla likes, and less of what Anilla dislikes.
I'm not saying that that second idea isn't present as well, but the proximate issue seems like the former one. More communication is generally good anyways, but a streamlined channel through which you can more easily deliver information which devastates your partner would probably not yield the results you're hoping for.
Fighting through someone else's poor self-evaluation is hard, especially if communication isn't strong between you. The problems which underlie your partner's issues may be beyond your ability to address either in your relationship more broadly or in-the-moment. That said, some things that might help include:
1. Be responsive and positive during sexual activities overall
Your partner won't know what's going on in your mind unless you express it, and your partner will probably like hearing positive things about their performance. Vocalizations and behaviors which demonstrate that you are enjoying things (the things you actually do enjoy, at any rate) might help reassure your partner. This can be true both of the overall experience and of specific things they do, and someone with low self-esteem may need both.
Even bland, generic communication can be enough for this. "I like that", "that feels really good", "keep going", and similar can do a lot to make it clear to your partner that they are doing (at least some) things well, which can avoid a spiral into despairing distraction. I'm not saying you should lie about liking something you don't, or overstating the experience you're having. But make sure that your partner knows when they do something you like. If the only feedback they (feel they) get is when something goes "wrong", it's easy for that to become their entire conception of your experience.
You already get direct knowledge on how much you are liking things. Make sure that your partner also knows when it's good for you! It's easy to assume that signals which are clear to you are clear to your partner too, but they won't have the same inside information as you.
2. Be ready to take the lead if something doesn't go smoothly
If your partner is driving the overall encounter, but then their confidence and attention are disrupted, then things can go off the rails pretty quickly. A more confident partner may be able to rally and try again, but a less confident partner may be less able to do so. Being prepared to take the lead elides this.
So if something doesn't work as hoped, you being ready to re-direct to a different activity can get over the derailment. It can help a lot if you initiate something that you both know you like, or that you can clearly indicate to them that you like. It's valuable to be positive here as well: not "let's do this instead", but "I love it when we do this, so let's do it!".
Phrasing that keeps "blame" (and a person with low self-esteem can read blame into a lot of presentations) off of your partner can be helpful. If you say "I thought that would work! I was way off" can be better than the passive-voice "well, that didn't work!", and is definitely better than "you didn't quite pull that off".
Your goal is to keep things going, such that your partner will not fixate on the "failure". An obvious, enthusiastic continuation of activities will help support that. Your partner is making course corrections after drifting a bit, not crashing into icebergs. They seem to have trouble understanding that, so demonstrations from you will help.
3. Sex has a visceral, in-the-moment quality. Don't rely on abstractions to counteract that
It sounds like your partner is pretty focused on what's happening in the midst of your encounters, and is having a less-than-ideal response to it. Telling them something abstract and logical may not do much to counteract that-- the emotional response will come first and can be hard to deny. Saying
I'm pursuing pleasure, so when I say that I don't like something I'm just trying to nudge you in the right direction, not put you down.
may not help with this problem at all. In the moment, your partner is expecting (or hoping for) a positive reaction, whatever that means to them. When that doesn't materialize, and they are confronted with the opposite (undesired pain or discomfort), there isn't much escaping from the conclusion that they failed. Whether or not you're trying to put them down is irrelevant-- if they'd done "a good job" you would have liked whatever it is that they did, and because you did not they obviously (in their own mind) chose the wrong thing, or executed the right thing poorly. It's a lot to ask of many people to disregard that in favor of a meta-understanding of the overarching situation and their place in it.
4. Establish casual, on-going communication about sex outside of sexual interactions
If your partner isn't sure what to do, or how to do it, it might take a lot of willpower to actually try doing something. If it goes poorly, that can be a big blow to the ego. More conversation about things you'd both like to try, how you might go about it (if applicable), and so on can lower that hurdle.