The way to optimize the pathfinding is to not do it so often.
Do it when the NPCs are away from the player and do it rarely - once every 5 sec. You need to get them to the same room or space as the player using PF. Nothing more.
Also you can group close by NPCs, choose a leader and path-find only for them assuming the other NPCs in the group will just follow.
Once close enough just move in a straight line to the player, eventually with some boid avoidance.
This will not solve mazes for you but will work in almost any environment. For 1000+ or very large spaces use flow maps.
If you want something “out of the box” you can check Detour Crowd Manager and their crowd avoidance here: Using Avoidance With the Navigation System in Unreal Engine | Unreal Engine 5.6 Documentation | Epic Developer Community