Just because operation 1 happens before operation 2, that does not mean that thread B will see the result of operation 1 before it sees the result of operation 2. The write to X could get "delayed" causing thread B to see the write to Y but not the write to X, even though the write to X happened first on thread A.
Yes, 1 happens before 2. But thread B can still see 2 before it sees 1. Forget execution orders completely. You cannot use them to reason about this kind of thing. Thinking about writes becoming visible to other threads in a delayed manner is a much less confusing way to think about it.