how to handle plugin related engine api changes

I have decent amount of experience making engine level changes, but looking at things from the perspective of a ‘plugin’ is new to me so seeking some advice in that regard.

Lets say the domain of the engine I want to develop plugins for was shall we say not designed with plugins in mind. In other words from what I can tell I would need to add (functions) to the engine api my plugin is dependent on in order for the plugin to work.

Is doing so directly and including the modified engine .h/.cpp files along with the plugin simply the only way to do it? Or is there same way to more encapsulate everything into the plugin that is recommended (in a scenario where the required engine api class is abstract, with multiple derivations)

Another question along the same lines is what if the required implementation of the plugin provided class requires not merely newly added functions to existing apis, but modifications to the body of existing api functions (across many functions). Any recommendations?

The answer I got from epic was simply that plugins (for the marketplace) have to be 100% encapsulated. So if the engine api I want to extend through a plugin cannot be extended through a plugin without first being modified then I have to submit such modifications as a pull request and wait until its integrated before submitting the dependent plugin, such a plugin would naturally be pegged to the engine version that change is release with.