Hey! It's good to see another Godot developer. This is really interesting and helpful for the future so thanks!
A quick thought: Have you thought of using a collision polygon2d or collision shape2d a little outside of the walls (in the areas the enemy shouldn't see). So when the player enters it a signal is sent to the enemy that indicates that they cant see the player. I'm not sure if this helps or not but I hope it does. Good luck on your project!