that's not how the AI works, they identify the nodes in the room as being available when they have the key in their hand and then have to choose to go to one of those nodes while panicking from a pred because that is the only time they use their interaction (you sometimes see them drop their paper due to this) before they will unlock a door
making a more specific AI that would identify key locations and lock onto it would be hilariously bad considering all it takes is one random student with the only key available to make it an easy win, as the "target" would either derp out and stand in some random place forever, or it'd be latched up against the random student's back
there's also the fact there should be a penalty for eating the wrong students when considering this type of a mode, considering the inversing of penalty means keeping stuff down is harder the more students you get wrong until you are left in a crazy apple state which allows the target to walk around without issue