i *think* that the best way to achieve this is to allow a library/framework to run some code when being setup. for me the obvious place would be the "-meta" file (Gem-meta.pd) which has become the de-facto standard to add meta-information to a library.
It could be very nice and configurable.
I'm curious to look at the libdir loader source file but I don't .
Best.
Jérôme.