The criticism can be useful even if it does not have good intentions. Usually those who want to hurt you, know just what to say to hurt you. If the criticism is completely baseless, it often does not make you angry, as you can trivially say why it is baseless. So it often such criticism also has an element of truth.
If you are angry, it is difficult to discern what are the truths. So it is useful to approach criticism both from good and bad intentions both in the same way. In other words, by default, if you get angry, try to figure out what in the criticism makes you angry.
I’ve been in this relationship. If someone knows what to say to hurt you, and uses it with precision to cause that hurt, they’re not on your team, even if their criticism isn’t “baseless”.
In the professional world, giving feedback with tact and respect for the contributor is what we get paid for and enables a team to contribute to the company’s success.
If someone on the team doesn’t feel like they’re treated with respect, even when their work needs improvement, it doesn’t matter whether the feedback was given with good or bad intentions.
Nothing you say is wrong, but it's somewhat tangential to what the parent is saying. If someone is saying things to you with the intention of hurting you, you should do whatever you can to minimize interactions with that person; break up with them, try to get them fired, try to switch teams, get a new job yourself, or whatever. This does not contradict the idea that you can learn from people who aren't trying to help you, though.
Of course, the dangerous part is that you may learn the wrong thing. Extracting constructive feedback from criticism that was not intended to be constructive requires a certain level of self-confidence and psychological safety that's only possible when it's an unusual event rather than a continuous drag on your self-worth.
If there is a person consistently giving hurtful feedback and I would be in a position to get the person fired, I would do it. (And I have done it.) And I would not work in such a work environment. At least 50% of programming work in typical organizarions is about getting along with people.
But I have found myself in environments where I needed to tolerate this to a degree. And the only thing you can ultimately change is your own attitude. If you can see that hurtful criticism may be even more truthful than other criticism, it helps to develop the right attitude.
If you are angry, it is difficult to discern what are the truths. So it is useful to approach criticism both from good and bad intentions both in the same way. In other words, by default, if you get angry, try to figure out what in the criticism makes you angry.