Is stationarity of data necesarry in order to do any statistics? If we assume we have a stochastic process $X_t$ for which we have,
$$\mathbb{E}[X_t] = \mu(t) $$
$$\operatorname{Cov}(X_t,X_s) = \gamma(s,t) $$
where the dependence of the functions on $s,t$ are non-trivial.
Is it now impossible to perform any  statistical inference, or machine learning on this process, because some of its defining features vary over time?
Do these processes with these kind of properties occur often in reality?

If the process is nonstationary in the sense of each observation being drawn, in an entirely unrestricted fashion, from a different distribution, i.e., having a different mean, variance, marginal distribution,... then statistics indeed cannot perform its magic of teaching us something about these distributions (and we then haven't even talked about unrestricted dependence yet): we then only have one observation per distribution, and there is already no way of estimating a variance from a single observation, and also estimating a mean from a single data point is not recommended (let alone trying to estimate the dependence structure or distribution).
On the other hand, there are many processes that are nonstationary, but in a more "structured" fashion, for which we can learn a lot. Take, e.g., a random walk
$$
y_t=\phi y_{t-1}+u_t\quad \phi=1
$$
If we do not know $\phi$ (i.e., it could to us also be a stationary AR(1) process), a regression of $y_t$ on its first lag will estimate $\phi$, and that in fact unusually well indeed, see e.g. Estimation of unit-root AR(1) model with OLS
