When the manual says "without invoking another program", it means that the shell doesn't use
execve to execute another programs. When a command uses redirection, the simple implementation is to
fork another process and do the redirection for that process only, leaving the file descriptors of the parent shell unmodified. This is also what
bash does with this command, as can be verified with
It is possible to do some trickery and avoid the forks for internal commands, but it seems they are not used in this case.
The second program can't detect that the first program exits, it can only detect that the output side of the pipe has been closed (which may happen because the program exited, or because of a regular
close). The reading side of the pipe will receive an EOF.
It is common but not necessary for the first program in a pipe to exit first. Consider:
sleep 10 | echo done
If the second program of the pipe exits before the first and the first tries to write to the pipe it will get the signal
SIGPIPE, which will terminate the process, unless it is caught.
(sleep 10; echo test ) | echo done