systemd-networkd-wait-online.service, as suggested in other answers, may help in simple setups but it does not fix the problem. If you mask the service then all other services depending on it will also fail. That means, all services needed to wait until the network is online will fail.
I run into this problem because I use a dynamic fail-over setup for my devices with bonding the wired (e.g. enp9s0) and wireless (e.g. wlp12s0) interface that are used as slaves for the main interface bond0. Exactly the same situation do you have if you use a bridge (br0 with slave interfaces). Only the main interfaces bond0 or br0 will get online but not the slaves so
systemd-networkd-wait-online.service will fail on the slaves.
The solution to this problem is to modify the service and ignore the interfaces that are slaves and does not signal to be online. You will find with:
~$ sudo systemctl cat systemd-networkd-wait-online.service | grep --after-context=3 '\[Service\]'
The program systemd-networkd-wait-online has a parameter to ignore specific interfaces. Check with
/lib/systemd/systemd-networkd-wait-online --help. So I make a drop in file to modify the service and ignore the slave interfaces:
~$ sudo systemctl edit systemd-networkd-wait-online.service
In the empty editor insert these statements, of course with your interface names, save them an quit the editor:
ExecStart=/lib/systemd/systemd-networkd-wait-online --ignore=enp9s0 --ignore=wlp12s0 --quiet
ExecStart= is important because it disables the "old" command. You can check for more than one interface (look at the help).