I see two scenarios here.
With most kids:
A: And then for dessert, what do you think we should serve?
B: I was thinking some--
B's child: MOM! MOM! Look! This book goes in the bucket!
This is interrupting. There are lots of ways to deal with it. I liked to make physical contact - hand on arm or leg, or around waist - and eye contact and say "I'm having a conversation. You need to wait your turn unless it's an emergency." Or other times "Is it an emergency?"
But you might be asking about:
A: And then for dessert, what do you think we should serve?
B: I was thinking something chocolate, everyone likes chocolate.
B's child: Well, I don't. How about pie?
This is a tougher call. It definitely happens as children get older, and they want to join in all your conversations, whether invited or not. I would typically laugh (to indicate it's not really a big deal) and say something like "not your conversation, sweetie, go back and play" and then carry on. One of my children, by school age, needed a separate chat later about not joining adult conversations unless invited. But don't worry, as an adult that child has no reticence left about joining uninvited conversations or meeting new people :-)