(IANAL) That's copyright law and not contract law. Perhaps X could try to put a clause in its ToS that publishing content there grants the copyright to itself, but I'm pretty sure it won't be accepted well even if it's legal.