Most developers I know do work for other people, either as a contractor or an employee. Two things that have taken me a long time to understand when working for others — but that I’m becoming more certain of — are that you shouldn’t work for anyone who doesn’t treat you with respect, and it’s up to you to make those you work for understand that they need to.
The software industry is full of young overworked, overstressed people. Often they also hate confrontation, and have limited skill or comfort expressing themselves. That applies to both the people signing and cashing the checks.
Because of this, if the person who’s hired you has something that’s bothering them, they’re likely to keep it to themselves until they feel it’s reached a head, and explode with emotion. If you’re not comfortable dealing with people like that — even if you know you’ve done everything right — you’re going to defer, apologize and back down. And you have good reason to be that way; they’re paying you and you want that money.
The problem you’ve created for yourself is this: you’ve now demonstrated to this person that they don’t need to talk to you in a business-like way if they’re feeling frustrated. And once someone loses respect for you, you never get it back. There’s no amount of money that’s worth working for someone who doesn’t respect you, and really, I don’t think most people are going to fire you because you showed that you have dignity.
One way to deal with situations like that would be to explain the first time it happens that you understand they’re feeling frustrated, but that your business relationship doesn’t make talking to you anyway they like all right. A better way would be to set things up from the beginning so that you the situation. Usually the problem is that people weren’t communicating, so make it as easy as possible to communicate with you.
If the people you’re working for don’t have an issue tracker — bring your own and have them use it. Explain how you want to receive feedback on your work at the start, and avoid getting it through email, because it’s really easy for others to abuse. Also, if you’re remote, avoid it being team chat if you don’t want to work the same hours they do. You want to pick something everything about the status of the project can go into it, and everyone can check at anytime.
You’re not going to fix anyone, and in software you’ll always have stressful situations. But you can do better than letting your work become a place you’re constantly disrespected.