Ohh the shortest route, I see. I was confused by the fact that it removed all the excess keys. Maybe you could keep the enemies taking the shortest route but leave all the keys on screen? Also I'm pretty sure at least one or two times I had a path that definitely connected to the end but it didn't allow me to run it.
Viewing post in Key Defence jam comments
The pathfinding system is a bit complex, but in essence it calculate the distance from the edge of one key to the edge of another key to determine if there is a valid connection between two keys. The margin is quite large so it should just work (- Todd Howard).
Do you remember what level it was and with which keys?