While generally speaking the answer is probably "GF logic", it also has to do with the concept of Happiny and Chansey. Both are known to be very compassionate Pokemon, that seek to help others. It's why in the anime and the early main series games, there is a Chansey (or several) assisting Nurse Joy in every Pokemon Center. It's also why in the second Pikachu short film, the missing Exeggcute is returned by a Chansey, who had obviously been caring for it when it fell from the nest. Happiny and Chansey are simply known for being helpful to those around them, and especially to those in need. So when the Pokemon you are battling performs an SOS call, it's not that surprising that a Chansey or Happiny would respond.
Somewhat frustrating, as you have discovered. But not surprising.