The Wizard doesn't know how dangerous those adventurers are. There is no implicit "I will only face people who I am able to defeat, yet find challenging" agreement the wizard can rely upon. In a typical D&D world, there is a huge power range, and it isn't easy to tell if a given bunch of people are weak or strong.
All she knows is that her base was invaded and her guards were bypassed. They have proven more competent than her guards already.
An intelligent actor will arrange for layered defences. The outer defences attempt to alert himself of the danger, and in the event of danger escape becomes the priority. If the outer defences defeat the danger, then escape isn't required; if the outer defences are penetrated, victory is less important than escape.
The outer defences can also be designed to diagnose how dangerous foes are. The easiest (and most reliable) way to measure this is to try to defeat them; other measures (in a military example, scouting their army and determining its size and composition, for example) can be used. These are less reliable, and should be less trusted.
Presuming her goal is not victory, but rather not-defeat, the wizard should respond to this penetration with more layered defences. Some part of her guard (the lesser half) should be deployed to ambush and defeat the party. The greater part of her guard should go with her and guard her retreat.
The greater part of her guard should be deployed if the party manages to defeat the first "retreat guard" layer, and are continuing to chase successfully.
If the ambush party defeats the invaders, they will be well rewarded. If they don't, they have failed, and will buy time/distraction for the wizard to retreat safely. Their means of communicating/meeting up afterwards shouldn't lead the party to follow where the wizard is fleeing (at least directly), as the wizard should presume they will be captured and interrogated.
After the wizard manages to flee, then, another base of operations can be set up with new layered defences, with whatever exploit the party used sealed. Again, the outer layers should be set up to assess or defeat anything weak enough that the inner layers may be endangered, and the inner layers should be designed so that if the outer layers are penetrated that the wizard can flee.
This is a rational set of actions for someone for whom the base (the place they live) is far less important than their life. If the base is highly important (say, a settlement and source of nourishment for a town), they may choose to risk themselves, or more of their guards, to defeat the invaders. This is the maxim that you should always leave a means for your foe to flee, because cornered foes are more dangerous: they will turn with all of their strength, instead of just with the strength required to protect themselves.
Now, suppose the base is of high value and the wizard is willing to risk his life, and most of his henchmen, to defend it. Or the wizard thinks that the party is not that dangerous, so he can mop them up, and doesn't shy away from personally exposing himself to attack (remember, in D&D as in real life, line of sight plus a failed save/lucky crit can kill you: even if you win, you can die.)
So the wizard is going to set up an ambush.
Ambushes are hard to get right. Unless you are a highly practiced elite military unit, your ability to do distributed tactics flawlessly and reasonably quickly is going to suck. As a DM, you can just move the units around -- but instead, you have a wizard talking to a bunch of dumber creatures and detailing exactly what steps to take, and not take.
If you have centralized control (the wizard), then extra hands don't help speed much (basically, the wizard has to do everything themselves), and the cognitive load on the planner is extremely high.
Have you ever run a MMORPG raid of modest size? How about doing it without any cheat descriptions of what the fight is going to be, or maps beyond in-game scouting and knowledge?
Now, do it silently, without being able to communicate in-game beyond a local /say style communication (no yelling! You are setting up an ambush. And no global chat).
Plans that rely on complexity fail in practice. Modern militaries can do some amazing things with complex plans, but that is because they have ridiculous levels of training and radio communications.
If you don't have centralized control (the wizard does it all!), you rely on each person knowing their role and doing it consistently with everyone else's role. This requires lots of practice, and (in practice) is the way you pull off decent sized ambushes. Everyone has practiced the ambush together, and knows what to do without having to communicate; variations are described, and everyone knows how to adapt.
The wizard's underlings -- are they brutes, or an elite military unit?
Your complex ambush, with doors being locked jammed and a funnel and the like, is not something you are doing to pull off successfully in the heat of the moment, unless they have practiced for exactly that many times.
If you try, things will go wrong. Or, more importantly, it is reasonable for things to go wrong. As a DM, your goal is to create a reasonable world. Having everything go right for the bad guys may also be reasonable, but if it leads to TPK, it is also reasonable for not everything to go right for the bad guys.
What will go wrong? Here are some ideas: you'll lock a door and someone will be on the wrong side. You'll leave tools out where the PCs can see them. Or someone will cut themselves and splash blood, and maybe cry out. Or someone will go the wrong way or do the wrong thing. Or you'll forget to lock a door. Or the retreat-covering team will engage before the primary team does. Or the retreat-covering team won't engage in time. Or you'll be half way through prep when the party arrives. Or the team watching for the party approach will get ambushed by the party. Or a door they play to jam doesn't want to get jammed. Or someone will speak too loudly at the wrong time. Or they will open up the side-ambush doors too soon, too late, or the cross fire will hit each other, or the fire-bomb trap will go off before the party gets there, or...
You can say "but they are too competent to fail that way!", but they in real life people doing something new for the first time screw it up pretty reliably.
A perfect ambush requires everything to go right. A failed ambush requires one thing to go wrong. Having something go wrong when the ambush is set up after an unforeseen penetration of your defences, followed by a surprising amount of time to recover, is very reasonable.