it should be possible to do that with dynamic patching using messages to
pd
...
the problem is, that then you have to do the wiring outside of the object dynamically too (because the connections are made before you can create the iolets)
variable in/outlets are possible with dyn~, where the outbound number of connection is given at dyn~ creation, but you can adjust the inbound connectivity (and all the objects inside) to your likings.
best greetings, Thomas