I took part in a class about interpersonal communication in business, assertiveness (the real type, not shitty courses about generic self-help) and handling stressful situations - they didn't really teach me how to "win" against the other person, it was more about feeling fine with my response hours after the fact and knowing I said the right thing without failing to communicate my intentions. Part of that was understanding how I react under pressure, seeing faults in this reaction (e.g. getting more aggressive, becoming stiff as a board, heart pumping, unable to formulate words, spouting insults etc.) and learning techniques to help accommodate them. You kept your cool and knew your heart was racing, which is a step in the right direction.
And on the other hand, if the other person is doing something I disagree with, techniques exist, too. They're mainly there to help formulate a certain way of speech, as a form of feedback that sends the message across without petty secrets or playing coy. In general, you state concretely what situation or behavior you had an issue with, you state how it made you feel (part of assertiveness is learning emotional intelligence), then what you want to change (no asking please, that undermines your intent). For other situations, like cutting the situation short, refusing to continue a topic, or demanding someone to stop neglecting you, there are techniques for those as well.
I wish I could link you any of these techniques or offer any guides, but I have zero clue what I could consider trustworthy or useful, seeing how the Internet is riddled with cheap knockoffs. There's way more material about this in my mother language and it doesn't translate to English well. Closest thing I found is "I-message", but that's a basic ass method out of plenty.
Either way, what I said can genuinely work assuming the other person is willing to listen, or if you know you'll keep seeing them again (in the workplace or in your circle of friends). But in a genuinely random situation like this against a person who can't control herself and just gets pissy as fuck, yeah, there's no point in following through. Assertiveness is not about always being proactive and always using these methods etc. etc. - if it's not worth it, don't bother.
You did a good thing by standing up for the kid and you've made your intentions clear. That's what matters in the end.