It is known that $R^2$ should not be compared between two regressions where one uses features $X_1,\dots ,X_n$ to predict $Y$ and the other uses those same features to predict $\log(Y)$.
However, this relied on taking the logarithm before taking the expected value.
If we consider two GLMs with Gaussian conditional distributions, one linearly modeling $\mathbb E[Y\vert X=x]$ and another linearly modeling $\log\left(\mathbb E[Y\vert X=x]\right)$, is the comparison of $R^2$ values still illegitimate?