Pathfinding finds the shortest route between object and target and ideally works for top down games, where gravity isn’t a consideration.
When your player is up in the air, the shortest route from the enemy is a line into the air; it’s not along the platform.