If we want to calculate $\mathbb{E}[X]$, we know this is $\int_{-\infty}^{\infty} x f_X(x) dx$.
When we want to calculate $\mathbb{E}[X^n]$ (for, say, positive integer $n$), we also do this with respect to the pdf of $X$, i.e. $\mathbb{E}[X^n] = \int_{-\infty}^{\infty} x^n f_X(x) dx$. Why can we do this? Is $Y = X^n$ not its own random variable, and so should the expectation not be calculated with respect to the pdf of $Y$ (which could be derived using e.g. some transformation rule), something like $\mathbb{E}[X^n] = \int_{-\infty}^{\infty} y f_Y(y) dy$?