In summary, if you kill Lae'zel, be ready for this eventuality. Or, if you skipped the spoiler, enjoy!
The ambush is tied to the player's in-game decisions regarding the lich queen. It's the decision of that unholy goddess that you be hunted - or not. I don't believe this is tied to Lae'zel, or any companion, alive or dead. Until recruited by Tav, Lae'zel was really just a nobody, dreaming of her lich queen's favor. The reason why she may cease to be a nobody is solely thanks to certain actions by Tav (or Durge). That is very clear by reading the in-game account of her personal quest (if recruited and also lives long enough to tell a story of hers).
Regarding this ambush:
Technically ---- The gith squad is level 9. Their leader has 2x to 3x as much health as our party members do. If your party is (well) below level 9 and is surprised, it's very possible to see a whole party wipe right here on Tactician+ difficulty. However, a party tailored for survival is unlikely weak. For example, if you don't respec any of your companions, at least Karlach cannot be surprised at this stage. And if Astarion is multiclassed to Ranger in a most popular way, he likely cannot be surprised either.
In a worst scenario, even if you are ambushed with no warning, your entire party should just get up (if downed or killed) and dash to the south, leading the pursuing gith squad into the deep shadow. Result? You live, they die, you win the battle with no shots fired!
I vividly remember this ambush during my first playthrough. I ignored the in-game verbal warning by my Durge and later forgot all about it, until actually ambushed. My party was level 8, beneath the bridge, unprepared. Interestingly, during the ambush, the entire gith squad almost completely ignored my Durge, as if she did not exist, despite that she was the very first on the front line all the time and did not leave that spot. All three companions were badly wounded, Shadowheart even downed once (which was my choice!), but my Durge only lost a few temp HP. Due to this experience, I forever ditched heavy armor on my Durge, because i wanted enemies to attack her instead - ideally her only.