Combining the two ideas from How to override systemd unit file settings?, I would suggest overriding the ExecStart directive by calling systemctl edit systemd-networkd-wait-online.service, which will open an editor; put the stanza below into that file, then save and exit the editor:
[Service]
ExecStart=
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online --any
That command will place a file at /etc/systemd/system/systemd-networkd-wait-online.service.d/override.conf with those contents. The doubled ExecStart directive is not a typo; it's important to first clear the existing contents before setting your own.
Because that /lib/systemd/system/systemd-networkd-wait-online.service file is provided by your package manager, you're bound to lose one update or the other:
- changes to files under /lib may be lost during package updates
- changes to the ExecStart directive by the package manager will be overridden by your local override.
It seems to me that the second option is the better choice, since:
- it's in /etc, which should not be affected by package upgrades (so your change won't be completely lost)
- you can add comments to the override file explaining what you're doing and why
- packaged changes to the ExecStart can be merged (or not) into your local override if & when they do happen
If the package decides to rename or otherwise move the systemd-networkd-wait-online program, your override would break until you update it (but if that happened, your change to the file in /lib would also be lost and so your functionality would be lost anyway).