I see this type of inference made a lot, for example in the context of distributional justice: A makes an investment. A thinks this investment was a rational decision, until he learns that B also profited from A making this investment. A now no longer thinks the investment was rational, and that some measure must be taken to prevent these "undeserved profits" on B's part from occurring — even when B is not seen as an enemy, but the general attitude towards B is neutral.
Since B is not an enemy whose benefit is seen as a problem in itself, and the act was seen as rational in itself, it is clearly a fallacy to infer from the new evidence of B's benefit that the act is no longer rational (or even weaker: that there is some ethical problem with this situation). Is there a widely used name for this?
Edit
Thanks to the comments, and after considering some examples, I have concluded that my question is indeed describing a situation that doesn't really occur. In those situations that I was thinking of, an action is criticized not for being irrational but for being unjust, despite leaving everyone better off than before. While I find this intuitively odd, it is not a fallacy.
B
is a free-rider (aka parasite), and indeed this legitimately can effect the rationality of the investment, as it can lower profits, or longer term even make a profitable investment into an unprofitable one. HoweverB
is benefiting from but not contributing to this arrangement, that money has to come from somewhere, and it’s eitherA
’s pocket directly, or the returns which otherwise would be reinvested and improve the system, etc.