I feel very invalidated and unheard when someone says this to me, but is it my own fault for expressing how I feel to them?
My perspective is that we all are vulnerable, and it takes courage to step up and show that vulnerability. It is often necessary to expose vulnerability in order to get needs directly met. One may have an injury that necessitates going to a doctor, but the outcome is not in their control; they can end up cured and happy to have recovered, they can end up with a jerk who makes them somehow worse than when they came for help, or they can leave the doctor no better and no worse. In the case of the latter, hopefully there are other doctors and one can keep searching. What we can't control is how others will perceive our vulnerability and need, and how they either respond or react to it. It is on them.
If you know someone well to whom you are considering disclosing your vulnerability, then their consistent behaviors may give you a clue as to what response you can reasonably expect from them. This will help you discern who is more likely to be safe to expose your vulnerability to if you seek to receive acceptance of who you are and what you are experiencing, and if you're lucky, additional support in the form of a more helplful perspective or just a needed hug.
If their response is out of character, then you can ask them why this particular subject garnered that response, because it is something about them you did not know and it would be helplful to know, and may also be helpful for them to become aware of. A reaction usually comes from unawareness or filtering what they hear through a charged past experience. You can also use your discernment to decide if it's best to let the subject go with them because they're not someone to pursue it with; it will then be a subject that will be off limits in the relationship if it causes discord in an otherwise mutually beneficial relationship. It just can't go to that particular depth. If it changes how they relate to you moving forward, it was about them, and perhaps it was good that the crisis occurred to bring about a change, as the relationship could no longer meet your needs or theirs, and likely wasn't meeting them in the first place.