Correcting for multiple testing is easy, and there's a lot of literature around it. But now consider a different problem.
Say you have $X$ and $Y$ and you want to estimate $E[Y|X=x]= f(x)$ where $f$ could be any function.
Say you fit several functions $f_1, \dots, f_k \in F$ and you pick one of them according to some criteria (for example, via cross-validation or whatever other criteria you prefer). Let $f^*$ be the chosen function.
Now you want to do inference with $f^*$. For instance, suppose $f^*$ has some parameteric form (for example, a GLM) and you want to obtain confidence intervals for some of the parameters.
If you had started with $f^*$ to begin with, then inference is easy, just traditional statistical techniques. But you didn't start with $f^*$. So how can you do inference properly, taking into account the fact you have searched $f^*$ over a set of functions $F$?