It is impossible to write Fantasy without, at some point, having guards. Things which are important need to be looked after! They need to be kept free of inquisitive people and opportunists. Doors need to be watched and important people need to be protected. Not unlike our own world.
The problem you run into is that guards have been turned into clichés.
“The reason that clichés become clichés is that they are the hammers and screwdrivers in the toolbox of communication.” ― Terry Pratchett, Guards! Guards!
I won't argue that we should try to do away with clichés, to try would be impossible. However, working to make these slightly tired mainstays of writing more palatable and believable is something that can add depth and create a memorable scene.
In the opening of The Broken Lance I have a file of Angels guarding the rear of the tenement they were attacking. They did not know if anyone would try to escape through their field of fire and so rather than being an ambush they were guarding. Another mark in their favour is that the Steel Angels are the elite of Har Nast's military. They feature regularly throughout and are the most ethically conflicted group that Dietrich deals with. Making them inept, prone to laziness or even afflicting them with momentary lapses of weakness doesn't work. If they are the elite they must have earned that status. If they have earned their status then escape for The Prophet and her followers would require some heavyweight intervention. Which they didn't get.
It was remarked upon that the deaths of The Prophet & Co was a surprise. The reader in question had made a decision about who was on the good side and who the bad in that section of story. That decision then influenced a set of assumptions about who would live and what would happen.
The fact that the guards at the rear of the building were alert enough and quick enough to stop the escape of the target wasn't something that the reader had thought of.
This event is at the beginning of the book for a very good reason. Dietrich does not play by the established rules (as you will see), and neither do his friends or his foes. Guards are the simplest element of a story like this. They are holding all the keys and guarding all the doors (to paraphrase "The Matrix"). If they are alert or even eager, then getting past them becomes more difficult and the rewards for doing so are greater.
Imagine a city patrolled by keen-eyed watchmen, every bit as dedicated, professional and frightening as Orwell's Thought Police. What would drive them to that I wonder?