Yes, I forgot about that:
As a workaround I always add the line
/etc/qubes-rpc/qubes.WaitForSession
in rc.local before the first qrexec-client-vm command in the script.
rc.local
qrexec-client-vm