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?
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.