Patrolling NPC's pathing broken by contact with the player

So I have an NPC that is patrolling in a rectangle around some boxes. The player should try to avoid them, but if they don't it initiates a fight that they can choose to see through to the end or escape from.
The issue is that if the player chooses to escape the NPC's patrol route goes off kilter and they end up walking into a wall and getting stuck. I already have "skip if cannot move" unchecked. I think it might have something to do with going into and out of the fight resetting the move pattern back to the beginning when the NPC isn't in it's normal starting spot.
nothing can really stop that because the move route has to reset on such a case by default.

an existing workaround is to add a plugin that gives you the option to remember last event location and then write the event in a way that detects current position and adapts pathfinding to continue.

It might be possible to ask for a plugin that tracks steps in the background and jumpt to the correct command in a moveroute after an interaction, but no one has written such a plugin yet to my knowledge, so I can't tell if there is a problem with that idea.
add a plugin that gives you the option to remember last event location
Wouldn't it be easier or perhaps better to have a plugin that stops the event processing until the player moves out of the way, then continues the move route?
@Roninator2 that is not the problem here as that is already solved by unchecking the "skip" box.

The problem is that if the event is on an autonomous route AND set to interaction on action button (the initiate battle mentioned above), then the autonomouse route starts on top again after the interaction with the action button. And that messes up longer circular move routes because the event is not back at the position where that route originally started.
The best bodge I can come up with in the meantime is teleporting the guard back to his original start point upon completion of the battle escape. Not particularly neat, but better than the alternative.
You could use a pathfinding plugin. That way you don't have to rely on move routes. The event will go to its destination no matter where it is.
I was wrong. It doesn't restart the sequence. What happens is that when player touch or event touch activates after a step has been taken, but the step does not complete. So what happens is that the pattern is a single step out of line when you come back.

Does anyone have recommendations for specific pathfinding plugins? I tend to find plugins a bit of a russian roulette sometimes.
And if you don't want to use plugins, follow this part from the MV script call list:
--------
//for this example "charEvent" is the event you want to move, but you can use $gameMap._events
var charEvent = $gameMap._events[id];

// THIS IS THE IMPORTANT LINE, of course you have to put real coordinates instead of x & y
charEvent.moveStraight( charEvent.findDirectionTo(x, y) );
--------
Thank you for the help.
That's a really useful plugin, and i'm definitely going to use it. Annoyingly I stumbled on a super easy fix for my original problem. I put a "1 step forward" command into the post escape combat block of instructions and it made up for the missed step pre combat. Sorry for dragging you all in on this.

Original thread: https://forums.rpgmakerweb.com/threads/patrolling-npcs-pathing-broken-by-contact-with-the-player.126391/