The thing i am looking for is not magical at all... an ordinary shift register or GPIO chip, simply with software that is beyond my current skill to produce
Or indeed given the constraints:-
I want to make it work with libraries, without modifying said libraries.
beyond anybodies current skills. Or indeed future skills with out the evocation of magic (which you have also ruled out). In short no you can't redirect pins from a library to your own driver without changing the library or rewriting the whole of the foundations of the system.