It is a build-time behavior. It does exactly what I described. It makes things behave as if the enhanced file imported the enhancing file. Nothing else.
You would then usually use it together with the registry pattern, a dependency injection system, or plugin system.
Please don’t overestimate the scope of enhance. It is on the same level of abstraction as import. It is just a primitive. You can build sophisticated systems on top of it, but it itself is not such a sophisticated system :)
So, I’d say it is not similar to your machine learning model. The 2 are completely orthogonal.
Enhance is really just a mechanism to establish a dependency between two files. Same as import just opposite direction.
You can implement DI systems on top of it, but the most obvious usage is with the Registry Pattern.