Agreement between two families that each will give its zakat al-fitr to the other
Question

What is the ruling on the soundness of zakat al-fitr according to a prior agreement between two families that each family will give its zakat al-fitr to the other?
Praise be to Allah.Allah, may He be exalted, has enjoined zakat and has made it a right that is due to those who are entitled to it, such as the poor and needy, and He has made it a means of purifying the giver from miserliness and stinginess. Allah, may He be exalted, says (interpretation of the meaning):
“Take Sadaqah (alms) from their wealth in order to purify them and sanctify them with it” [at-Tawbah 9:103].
What the one who gives zakaah must do is give it willingly; it is not permissible for him to stipulate that the recipient should do him some kind of favour in return for him giving him his zakaah.
Hence the scholars stated that it is not permissible for a creditor to give his zakaah to the debtor and stipulate that he must give it back to him in payment of his debt.
Ibn al-Qayyim (may Allah have mercy on him) said:
If the aim behind giving it to him is to revive his own fortunes and get payment of the debt owed to him, that is not permissible, because zakaah is something that is due to Allah and to the one who is entitled to it, so it is not permissible to give it back to the giver.
One of the things that may clarify that is the fact that the Lawgiver forbids the giver to take it from the one who is entitled to it in return for something. The Prophet (blessings and peace of Allah be upon him) said: “Do not buy it, and do not take back your charity.” He regarded buying it from him by paying its price as being the same as taking it back, so how about if he gives it to him with the intention of taking it back from him?
End quote from I‘laam al-Muwaqqi‘een (5/271)
The condition mentioned in the question comes under the same heading, because it is a trick to restore the zakaah (either what was given itself or something equivalent) to the giver.
Based on this scholarly consensus, the one who gives zakaah in this way has not purified himself from the characteristics of miserliness and stinginess, because he has not given zakaah except on condition that something similar be returned to him, and this indicates that he is miserly.
And Allah knows best.