"It depends."
At a previous (consulting) job it wasn't uncommon to spend the entire day in meetings, but still be required to get things done. The meetings really didn't need to take all day, but they did, and there wasn't much to do about that: It was happening, you had to at least be on the phone, and that didn't remove that you needed to get work done.
Meanwhile, while your input might be occasionally needed, you wouldn't need to be an active participant for most of it. Things would also come up in the meetings that needed to be addressed, and if you didn't have to say anything it was frequently more efficient to work on them while listening for key phrases about what you have to do. So you did work.
There are plenty of meetings that people need to attend for one reason or another that they cannot–and are not expected to–dedicate their full attention to, or at least not expected to do so for some percentage of the meeting. It could be argued that this is a flaw in the structure of the meetings, but it's also something that naturally happens when you get a bunch of people in the room: The conversation is not necessarily highly focused and relevant. Sometimes you are only there to answer questions if people have them, or are only going to be an active participant for ten minutes of a thirty minute meeting.
On the other hand, if you are in a small meeting where you are a key participant, even if you could fix an issue that comes up in the scope of the meeting very quickly, it is probably best not to do so if you can reasonably avoid it. You can slow down a meeting too much by missing key details or by having to have instructions repeated, or can block others if they need to wait for you to finish up a task.
Why I think this:
It's easy to say "we should fix this at the meeting organization level," it is a much harder problem to actually do that. Various groups have tried standing-only meetings and other such concepts to try and keep meetings focused, but they frequently meander, or they frequently cover multiple topics for which you only care about a few. Sometimes you know just by the nature of the participant list that it isn't going to start on time, and you make the according arrangements.
Ideally your meetings should be sufficiently short and focused that there's no temptation to fix things in the meeting, because it will be over sufficiently quickly that you can get back to it.
That said, you can try and get the meeting more focused and get people to take irrelevancies offline. You can try to keep the socialization down. You can try to do a lot of things like this… but while you are trying to take those steps there's still going to be work to do, and sometimes (e.g., when you are production support) keeping an eye on a monitor is simply not going to be made optional.
So grimace, try to get the format fixed, and then make the best decision based on cultural norms at the company (some companies tolerate it more than others) and by gauging the level of distraction relative to the level of benefit for the company.