X-ray-induced chemistry of water and related molecules in low-mass protostellar envelopes