What I mean is that the stacklevel before this one will be joblib code, not scikit-learn code.

stacklevel works poorly in practice when your function is not called directly by user code. Since the nesting of functions can change in different calling contexts and over time with rewrites and refactorings, it ultimately needs to be a parameter to the function.

And it hardly helps trace the warning.