If they serve an important purpose, you just sort of get through them with as a much grace as possible, but if not skip them.
Games are supposed to be fun. They are hobby. You are probably not being paid to play, and even if you happen to be one of the very rare individuals who manages to get paid to play this is an area where your performance probably benefits from you having fun too.
There are some things that may not be fun but that you have to do them anyway to make the game work. This is true in just about every hobby. You need to learn enough of the rules to function, and that may or may not be fun for you. You need to make or choose a character. I find that fun, but a lot of people think its tedious bookkeeping. Sometimes, you may need a serious talk about how the game should run. This probably isn't fun, but if you have a new group it may be necessary, especially if there are plans to include possibly sensitive topics such as torture, sex, etc. Sometimes, you need to sit through an info-dump from the GM/DM so you understand what's going on. In these cases, you sometimes just need to deal with it with as much grace as possible.
Similarly, sometimes what is unfun for you is the whole reason someone else is there. In that case, as long as you are getting enough fun to make the whole endeavour worthwhile, you focus on supporting their fun for a while. You may be able to enjoy the fact they are having fun even if you don't enjoy that particular scene. You may be there for the combat and they like the role-playing in between combat. In those cases, as long as the balance is reasonable, you support their fun with the expectation that they will support your fun when the spotlight swings back to your preferred section.
But the important thing is, the hobby as a whole should be fun. The stuff that is necessary but not fun for everyone should be minimized and dealt with quickly and efficiently. The stuff that is fun for one section of a group but not for another is necessary and everyone should support everyone else's fun, but it should be balanced.
While some unfun work is necessary for just about any hobby, as long as it is a hobby the fun should heavily outweigh the work and if it isn't then you need to examine the situation. Perhaps you need to talk to the entire table about rebalancing things so that you get more of what you find fun. Perhaps you need to find a different group to play with. And if that doesn't work, then its just possibly you may want to look at a different hobby.
Punishment for players is virtually never in order, and "punishment" for a character should be handled in a way that is fun for the player
I admit that this is a bit of a tangent, but you said "We lost, so I guess some punishment is in order before we can try being heroes again?" No.
Players should almost never be punished. Generally, you are all peers enjoying a hobby together. Peers generally do not punish each other and definitely should not be trying to punish each other over a hobby.
In fact, I can think of exactly two exceptions and one strains the definition of "punish." The first, is that now that I have children there are sometimes mixed age groups with younger kids, teenagers, and adults or I'm present when my kids are playing without me. In that case, an adult in a proper position of authority (parent, guardian, or with permission from a parent or guardian) might need to actually discipline a younger player that is not behaving properly. Normally, a brief discussion is enough or timeout from the game is enough. The second is that the group as a whole may occasionally need to remove a problem player. But that strains the definition of punishment in any normal sense, it is deciding to continue the game without someone that is not contributing to the fun. And that is the only "punishment" I've ever seen appropriately used by a group against a player.
The game should be fun, you are not supposed to be punished for playing it.
Now, in character consequences for in character consequences are different. If your rogue commits a crime and gets caught, it is quite natural that the in-world authorities might try to enact a punishment such as imprisonment. In fact, it would be weird if the in-world authorities didn't at least try. But while that might be a literal punishment in-world for the character, the GM/DM should be structuring it so it creates interesting new opportunities for adventure immediately, not making the character sit through a dull prison scene (an interesting prison scene is different of course. Plenty of media and even a few real life plots involve getting captured on purpose for different reasons...) before they can be heroic again.
In short, unless you're a minor playing with adults with a real authority over you, your GM/DM should never try to punish you and consequences for your characters should be natural and lead to new adventures, not boring.