You can log these commands with SSHLog https://github.com/sshlog/agent/ (I'm a contributor).
The app would catch all commands (including piping through bash as you cite in your question). It will also record commands that are typed via TTY and ones that are not sent via TTY. Here's an example where a user ssh into the server and runs:
bash
whoami
exit
The log file would show:
2023-04-18 16:47:59 command_start (2554513) jdoe executed /usr/bin/bash
2023-04-18 16:48:00 command_start (2554513) jdoe executed /usr/bin/whoami
2023-04-18 16:48:00 command_finish (2554513) jdoe execute complete (exit code: 0) /usr/bin/whoami
2023-04-18 16:48:10 command_finish (2554513) jdoe execute complete (exit code: 0) /usr/bin/bash
Notice the bash terminal opens, 'whoami' is run inside that new terminal, and when bash is finally closed it reports the completion of the command.