A resposta pode ser encontrada na página termios(3) man:
VEOF (004, EOT, Ctrl-D) End-of-file character (EOF). More precisely:
this character causes the pending tty buffer to be sent to the
waiting user program without waiting for end-of-line. If it is
the first character of the line, the read(2) in the user program
returns 0, which signifies end-of-file. Recognized when ICANON
is set, and then not passed as input.
O primeiro ^D que você pressiona faz com que a linha que você digitou seja entregue ao cat , para obter um resultado read(2) de a (um caractere, nenhum caractere EOL). O segundo ^D faz com que read(2) retorne 0, o que significa EOF para cat .