OK, let's break it down mathematically. I'm going to use a standard poker equity calculator for this.
- You have T⋄ 9⋄
- You say the all-in player had a medium pocket pair. For this "exercise", let's pick 8♠8♣
- Let's consider the third player a typical tight-agressive player, in this case with a standard 18% Range of hands preflop
- Since you didn't mention the third card of the flop, let's pick a complete blank, like 2♣
My equity calculator tells me that, at this point:
- your equity is 43 %
- the all-in player's equity is 23 %
- the third player's equity is 34 %
Now, what happens when we add 2 more players in the hand, both with completely random hands (100 % range) ? (what their hands or ranges are is totally irrelevant to the point I'm trying to make, you'll see)
The equities now transform into:
- your equity: 43 % became 37 %
- the all-in player's equity: 23 % became 14 %
- the third player's equity: 34 % became 25 %
- the other 2 players both have 12 % equity
What I want to focus on are only 2 things: the number of players and how the all-in player's equity changed a.k.a. IT WENT DOWN.
The conclusion is that, the more players there are competing for a pot, the smaller the chances are that you'll win it 1.
For this exact reason, a typical play when a player is all-in is for all the other players to check it down, so that there will be a significant higher chance that the all-in player gets eliminated. I do it all the time in tournaments and you should too (this type of play is typically done at tournaments only, not cash games).
The only situation in which it makes sense to continue betting (and building a side pot) is when you have the nuts or something extremely strong (like Aces full, quads, straight flushes etc.). You want to do this in order to extract more value out of your hand. In this case, you can pretty much be sure that you have the best hand, since players will usually go all-in when they're short-stacked, which means that a marginal hand is "good enough to shove".
Since you didn't check it down in that situation, my guess is that this is the reason why someone else at the table told you that you made a donky play. People should be nicer and restrain from this type of comments (keep it to themselves) but, in this case, I think that person had a point: it would've been optimal for you to check it down all the way.
1 = This is essentially and fundamentally exactly the same reason why it's best practice to raise preflop: more players will fold, which means you'll have fewer opponents and, generally, higher equity.