I loathe it when people do this for small group arrangements. I think it's fine to throw your completely different friendship groups together at a large event, like a birthday party or wedding, as people can either stick to socialising with people they know well or branch out if they want.
For a small thing, however, it's crap. The usual scenario is that just you and friend A planed to get drinks and now they've invited X. X is usually someone who you either don't know at all / or don't know well because you've only met them once or twice friend A's events and only ever spoken to them out of politeness towards A.
It just completely kills the dynamic and ruins the evening when this happens, because you are not going to be able to talk freely and be yourself in front of someone who you either don't know, or vaguely know, and have no desire to get to know better.
I cancelled on a friend earlier this year because of this. I was going to drive to see her and catch up for the first time since Covid (so 2 years + since we were able to properly catch up) and the morning of, she messages to say that some relatives of hers, who I have never met, will now also be at her place and we can all have a meal together.
I was honest, and said that visiting in those circumstances would defeat the point of the trip for me (to catch up with her) so I would prefer to do it another time. She understood, and we caught up later in the year.
I think the only way to stop this happening, is to not grit your teeth and endure it, as if the friend who is doing it is more extroverted than you are, they are not going to have a clue that it's problematic for you unless you tell them.
It's very unlikely that people are being deliberately thoughtless when they invite randoms. Most likely, it's because they personally have no issue with suddenly having to make conversation with a total/near stranger, so they will need reminding if it's something that you personally hate to do!