Hi Zsolt,
Thank you for sending me the project. I tested it and, indeed, I reproduced the behavior.
However, I noticed that because of the "NOT UPGRADINGPRODUCTCODE" condition that is set for the "AI_FwUninstall" custom action in the "Table Editor" page, the firewall rules added by the first version are not removed during the upgrade to the second version. Furthermore, those rules are added again by the second version, so they gets duplicated. Hence, during the uninstall of the second version, only the rules this version added are removed.
In order to avoid this, you need to go to the "Windows Firewall" page and, as mentioned in the second post above, use the following condition for your rules: NOT OLDPRODUCTS
Best regards,
Eusebiu