Hello,
Expectation is indeed a Lebesgue integral. When we write $\mathbb{E}{(X,Y) \sim D} f(X,Y)$ it can be understood as $\int{X, Y \in \mathcal{X} \times \mathcal{Y}} f(x,y) p_{D}(x, y) dx dy$ where $\mathcal{X}$ ad $\mathcal{Y}$ are the input and output sets and $p_{D}(x,y)$ is the density of $(x, y)$. So the first expectation in your equation, means that you integrate over all possible samples weighted with a density function of the distribution $D$. Note that in practice, we don’t know this density function, so the expectation term is approximated by an empirical average, this is why we take the average over all elements in the dataset.
Some parts of what I said here an not 100% accurate, I need far more space and notation to write the exact definitions, but I hope my answer was clear.