The function $f:M\subset \mathbb{R}^n\to Y$ with values in Banach space is called measurable iff the following hold
1) The domain is measurable
2) There exists a sequence $(f_j)$ of step functions $f_j :M\to Y$ such that $$\lim_{j\to\infty}f_j(x)=f(x)$$ for almost every $x\in X$.
Proposition $\,$ $f$ is measurable if the following hold:
1) $M$ is measurable and $Y$ is separable Banach space
2) $f$ is continuous almost everywhere
What is the proof of that fact? One should construct a sequance of step functions. To do so, separability would be useful I guess. If $Y$ is separable we may take the values needed for step functions from the dense and countable subset of $Y$. How to define $M_i$? The very first idea that came to my mind is: if $a_i$ is a value from dense and contable subset of $Y$, why not to set $M_i=f^{-1}(a_i)$?
Let $E$ be the set of discontinuities of $f$. Since $M\setminus E$ is measurable, there exists a sequence of compact sets $K_j$ such that $$ M\setminus E = N\cup \bigcup_{j=1}^\infty K_j $$ where $N$ has measure zero.
Fix $j$. Cover $K_j$ by open sets $U_{k}$ such that $\operatorname{diam} f(U_{k})<1/j$ for every $k$; this is possible since $f$ is continuous on $K_j$. By compactness, we only need finitely many such sets. Pick $y_{k}\in f(U_k)$ and define $$ f_j = y_1\chi_{U_1} +y_2\chi_{U_2\setminus U_1} + y_3\chi_{U_3\setminus U_2\setminus U_1} + \cdots $$ Also let $f_j=0$ on $M\setminus K_j$. Observe that $f_j$ is a step function and that $|f-f_j|<1/j$ on $K_j$.
For every point $x\in \bigcup_{j=1}^\infty K_j$ we have $f_j(x)\to f(x)$ by construction. The rest of $M$ has measure zero. $\quad\Box$
Didn't need the separability of $Y$.