The Formula and Switch nodes are able to grow new ports based on what I put in the inspector. How is that done? The documentation does not say.
The answer is, inside the Definition method you just add as many ports as you want using any logic you want. The member fields are only for the default, reflection-using descriptor, and are not needed for the unit to function. If you create your ports dynamically, you should also write a descriptor for your unit to style the ports.