There are two incidents – YC, and injury. They could occur in either order, and the returns could be in either order, giving 4 scenarios.
For simplicity I assume no more FR subs are available by the time of the incidents.
1. Injury. Causes uncontested scrums so player cannot be replaced. Down to 14.
YC. Player cannot be replaced. Down to 13.
1a. YC returns. Still uncontested scrums. Back to 14.
Injury returns. Back to contested scrums and 15 players.
1b. Injury returns. Still uncontested scrums. Back to 14 players.
YC returns. Back to contested scrums and 15 players.
2. YC. Player cannot be replaced, so uncontested scrums. 14 players.
Injury. Does not cause uncontested scrums, so player can be replaced. 14 players.
2a. Injury returns. Still uncontested scrums. 14 players.
YC returns. Back to contested scrums and 15 players.
2b. YC returns. Still uncontested scrum, but now caused by injured player, so man off applies. 14 players.
Injury returns. Back to contested scrums and 15 players.
2b is the curious case, the others are straightforward. The argument against my view is that he has already been replaced, but the aim of the rule is clearly that a team should be one player short if the absence of a FR player results in uncontested scrums.
Although they are called Laws, they are not the equivalent of Acts of Parliament, and should not be treated like that. A referee should know the laws but make sense of them. Rarely should he be forced to do something that seems daft.