it looks to me that you are creating problems and complications trying to solve a problem that does not exist.
generic pin control solutions will never work for all chips, there are too many chip variations.

pic pins to date always default to inputs, analog if possible. leave them that way unless you need one to be different.
each and every pin you employ needs to configured to suit its usage

mcc makes it easy
Name:  demonp.jpg
Views: 2561
Size:  439.6 KB