Imho, this can be done while it’s a bit complicated depends on how many non-public AGP APIs you used.
I’m developing a “[Polyfill](
https://github.com/2BAB/Polyfill)” library which gathers all non-public AGP APIs that I used in other plugins, though min version support is AGP 7.x. The suggestion that derives from here will be: extract all non-public APIs to a set of libraries like
agp-compat-3.x
agp-compat-4.x
agp-compat-7.x
, and then build your plugins over them.