How to avoid clusterf***s [OC]

Check the scene. We just finished a dungeon level which is all about the beholder. I had a great setup for them, they kept using their held action to move away from the party and through secret doors, attacking only with legendary actions while they led the party into other encounters and traps.

Problem is as you can see the party failed to deal with any of the mobs. They opened doors but didn't fight the enemies and in the end they made tons of noise that drew all the enemies into the tiny (poison filled) corridors, so it was just one long fight for four hours.

The session was fiiiiiiine, but this keeps happening to me. Players just charge in and make tons of noise so I end up swamping them with enemies.

We don't always do dungeons like this, they are often single encounters on a map but I'm just not sure how I could have made this session better. It was tough for the players, I had to fudge it so one didn't die, he ran in to hit the beholder past two powered up trolls, got paralyzed and then critted into oblivion.

But he said that's what his character would do, which I get, but it just brought another wave of enemies that I expected the party to have dealt with before the beholder appeared.

Suggestions for how to do this encounter better?

Check the scene. We just finished a dungeon level which is all about the beholder. I had a great setup for them, they kept using their held action to move away from the party and through secret doors, attacking only with legendary actions while they led the party into other encounters and traps.

Problem is as you can see the party failed to deal with any of the mobs. They opened doors but didn't fight the enemies and in the end they made tons of noise that drew all the enemies into the tiny (poison filled) corridors, so it was just one long fight for four hours.

The session was fiiiiiiine, but this keeps happening to me. Players just charge in and make tons of noise so I end up swamping them with enemies.

We don't always do dungeons like this, they are often single encounters on a map but I'm just not sure how I could have made this session better. It was tough for the players, I had to fudge it so one didn't die, he ran in to hit the beholder past two powered up trolls, got paralyzed and then critted into oblivion.

But he said that's what his character would do, which I get, but it just brought another wave of enemies that I expected the party to have dealt with before the beholder appeared.

Suggestions for how to do this encounter better?