This is only true if your definition of value compels you to trade X for Y if you value Y more than X in the absence of external transaction costs. A simpler and more clearly symmetric definition would be, if given a choice between X and Y, you value Y more than X if you choose Y and vice versa.
An otherwise rational agent with hard-coded pairwise preferences as in the OP would detect the cycle and adjust their willingness to trade between X, Y, and Z on an ad hoc basis, perhaps as an implicit transaction cost calculated to match expected apples to apples losses from future trades.
This is only true if your definition of value compels you to trade X for Y if you value Y more than X in the absence of external transaction costs. A simpler and more clearly symmetric definition would be, if given a choice between X and Y, you value Y more than X if you choose Y and vice versa.
An otherwise rational agent with hard-coded pairwise preferences as in the OP would detect the cycle and adjust their willingness to trade between X, Y, and Z on an ad hoc basis, perhaps as an implicit transaction cost calculated to match expected apples to apples losses from future trades.