The thing is that the game only allows one support ship per team to be the REAL support ship, meaning it is the ship that will respond to all rearm calls. Every other support ship present will just float around.
Huh. I thought the game was specifically coded to rearm from the nearest support ship.
It is.
Technical explanation follows:
FSO recognizes MAX_SUPPORT_SHIPS_PER_TEAM support ships for each team. A support ship (any ship with the "support" flag), is considered valid if it is not dying, departing, ordered to warp out, or actively repairing/rearming.
Where the problem comes in is MAX_SUPPORT_SHIPS_PER_TEAM is set to 1. This means that no others are even considered because once the code finds one, it figures it is done. Because the search is done starting with the first object, it also means that you get the same ship.
Why battua's solution works (most of the time) is that a large factor for an AI to determine when to call the support ship is if a support ship is present in the mission, and IIRC if the player is actively being repaired.