If a player metagamed like that at my table, I'd punish them by not having any monster appear until everyone is back in bed. And have the character on watch be surprised.
The first (and pretty much only) time I played D&D I didn't know what "metagaming" was and accidentally thought about the puzzle as myself instead of as my player. Apparently the DM wanted justice and I ended up ruining the session for everyone. Needless to say I didn't go back out of guilt
Moral of the story: please try to be patient with your players. Not all of us are great at avoiding metagaming immediately :\
The way that my groups play it, the party is basically a hivemind of everything that the RL players know (minus Bestiary minutiae the PCs would have zero reason to know on first encounters), plus any knowledge the PCs might get from dice rolls. Just because I'm playing the 8 Int barbarian doesn't mean I have to go sit in the corner waiting for the next roll for initiative.
We just handwave the solution as saying the smartest PC came up with the plan, or if a dumb character rolls high, we role play him catching the Smart Ball and have the other PCs react in character.
Different tables have different tolerances for metagaming. Sorry you had a table that would rather browbeat the new guy for pushing that boundary instead of giving you a chance to adjust.
That's kinda dumb... It leads into why I don't really like "puzzles" in the traditional sense in TTRPGs... Either it is simply a DC you have to beat in a roll, and that is it, or it requires the player (not the character) to be good at solving puzzles. Otherwise, it isn't a puzzle, it is just an atypical "lock" requiring an atypical "key" reminiscent of old point-and-click adventure games where you just can't proceed until you find the McGuffin (some random detail or piece of information that is hidden away that in turn "solves" the puzzle that you could not have hoped to solve without it).
I'd love to be proven wrong, but I definitely haven't seen it done well.
This is why I tend to lean more towards puzzles that test how prepared characters are and how well they know what their characters can do. And even then I usually have a longer/more difficult way around the puzzle just in case they can't solve it. Like for example I have a magically locked door that they can try to get open but it would be difficult unless they have a spell or maybe getting lucky trying to lockpick it. However there is also a small cramped tunnel they can go down instead that will also get them past the door but will have some challenges along the way.
I just came up with a possibly acceptable middle ground of my own... Puzzle is intended for the players to solve, but if characters have an appropriate high mental stat or characters that roll well on an appropriate skill check would get varying degrees of hints or clues. Maybe? I feel like I'd have to try it to see if I actually like it or not. It feels like a sweet spot compromise, but still requires meta-game problem solving, but I feel like that is unavoidable - you can't actually think with your characters brain, only your own. At least with current technology, lol.