I see this type of inference made a lot, for example in the context of distributional justice: A makes an investment. He thinks this investment was a rational decision, until he learns that B also profited from him making this investment. He 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 who's benefit is seen as a problem in itself, and the act was seen as rational in itself, 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 clearly a fallacy. Is there a widely used name for this?
edit: thanks to the answer and comments, and after considering some examples, i have come to the conclusion 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.