Measurability of essential supremum of function of two variables
You are right. For each n choose a set of measure less than 1/n on the complement of which f is continuous. Now take the actual sup on each vertical section of this restricted function. This yields a measurable function $f_n$ for each n defined on X. The sup of the increasing sequence of $f_n$ will also be a measurable function F. Except for a null set, F will give the ess sup of the vertical section of f. So modifying F on a null set yields that g is measurable.