How can a widget's parameter be required and depend on another parameter?

It is a bug, report in on GitHub.
Please note that the system correctly handles the same situation in the backend’s «Stores» → «Configuration» section: the system does not validate an invisible field, even if it is required.