So if the allies suffer the problem when more are added then your state machine may be thrashing between selecting a foe, chasing and attacking when the number of allies<>enemies gets too high. Your intuition about acquire being a possible source of your bug might be right.
You might have a problem where the state is not changing even as the target is changing constantly.
IIRC the list of collided bodies/areas are not sorted by distance.
1) You might want to track bodies/areas with enter/exit. Both area/body collision lists are subject to the same limit
Array get_overlapping_areas ( ) const
Returns a list of intersecting Areas. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
Because each AI evaluates every other AI, the overhead is going up by a square of AI in overlap. Consider adaptive detection (area) if the # of enemies gets "high". Also consider making distance calculation is done once per pair of antagonistic AI
I'd pick Areas or Bodies for detection and not use both.
2) The problem occurring in the allies just may mean that they are unlucky.
You can test by starting with as many allies as you start with enemies, then adding enemies instead of allies. (make it so enemies don't die) You may then find enemies having the problems.
Also I recommend finding a way to trigger a break point when the problem occurs. Give your player controller the ability to pick a stuck enemy (like press a button to do a ray cast when looking an afflicted AI, and use that to trigger a break point)
if(self == some_global_context.selected_target)
print("something") #set_your_break_point_here or call some code to turn on logging on that AI instance
Also when building a FSM system, I would always instrument some code