Both return the same value when getenv is called on SSH_AUTH_SOCK from within an emacs client.
That looks unlikely. One would return ~/.ssh/ssh_auth_sock and the other would return /path/to/HOME/.ssh/ssh_auth_sock, no?
Have you tested whether SSH_AUTH_SOCK can actually contain ~ as a substitute for your HOME directory? Usually that would be expanded by a ...
The option -a specifies the editor that should be started if there is no emacs server started yet (the so-called "alternate editor). If the empty string is passed, as in the script above, emacs --daemon is run and emacsclient tries to connect to it (see man emacsclient or M-: (info "(emacs) emacsclient Options") within emacs). Unfortunately, in your case, ...
I fixed this by changing ExecStart in the systemd service file to:
--daemon is equivalent to --bg-daemon, which starts the emacs daemon in the background (disconnects it from a terminal). I'm still unclear on why this works, however.