What you want is optional input ports. I know that some nodes have them. I also found fossilised forum threads asking on how to code a node with opt. ports.
The only really relevant thread is this one, but unfortunately it seems that this is currently (2020) not possible at all:
I can’t think of a way to work around that. But it definitely is an attractive feature request!