You did fine, and it's good you're thinking about this stuff. This kind of thing is usually called a swimthrough. If you don't want to go through for whatever reason, you shouldn't. And while of course you don't want to be bouncing up and down like crazy for no particular reason, sometimes there's a good reason to change depth like that. A 10ft detour to avoid something you don't want to do is a good reason.
Some people are against rec divers going through swimthroughs, and others don't have a problem with it. In any event it's very common to go through these in tropical places. But if you're not comfortable doing it for any reason - including that you're with a group you anticipate will be a mess in there and you can't manage to be first
- then you shouldn't. Often some people will go through and some will go over - though it's nice to have discussed this ahead, and at least have acknowledgment from your buddy at the time on what each of you is doing.