I really think it's pretty much like "do you discipline someone else's child?"
In certain situations, non-pet-owners (and non-parents) are OK to step in. Life-and-limb situations (in which case, you don't so much yell, etc., as intervene--call the puppy/child away, pick up the animal/child and move them out of danger, etc.).
And of course, situations in which you've expressly been *delegated* the task of disciplining (you were taught the code words, or have been asked to be responsible).
Others, you either just shut up and butt out, or you say things like, "Kitty/Child, are you allowed on that table?" loud enough so Mom can hear.
And isn't it funny, OP, that the mere sniffing set both these people off? That they can't fathom that sniffing may be all the cat is intending to do, and you could probably wait and see, but they have to react RIGHT NOW? And they have to make a BIG DEAL out of it, instead of simply saying at a conversational tone, "no, kitty--don't you get on that table!" (But when the owner --or parent-- is right there, especially if it's not your table, I think it's off to issue an order directly to the pet or child. That's taking over their role.)
And I'm so intrigued by your choice of words--you described them both as "screaming." How much of your description is hyperbole, and how much is strictly accurate?
As for how to handle it, I think you might consider "channeling your inner daycare worker." Because you mentioned that when you thought about responding, you kept mentally wanting to yell back at them. To me that's a sign that your own emotions are deeply involved. And I think of the *best* daycare workers as being quite clinical about misbehavior. They don't get mad at kids in their care, because, well, that's just what kids are, so you correct them as calmly as possible simply because it is effective.
So if you were a -good- daycare worker, and a 3yo in your care yelled at a pet, how would you respond? You'd teach, right? And you calmly lay down rules.
So you say, "We don't yell at the kitty--it doesn't do any good, because he doesn't speak English, and he doesn't think you're talking to him, but it upsets the people who also hear it. We don't interfere with the kitty until *after* he has actually jumped on the table, because otherwise it just confuses him. Expressing an interest in the bags on the table is not a problem. And since we wash the table before every meal, we really don't get that upset about the occasional foot on the table."
Or, you say, "Please leave all the yelling at and disciplining of the cat to me. If you think I need to be alerted to what the cat is doing, just say something quietly to me."