X and Y happen simultaneously so you always get Y. However, you may still not be able to benefit from Y if X causes you to be exhausted and Y is an effect contingent upon you doing something after your are exhausted (like resolving an attack or moving).