> typing on a line, backspacing all the way to the start and then typing ~ also sends a literal tilde
for the younger readers, yes, because in terminal echo mode, "backspacing" does not clear your terminal line buffer, those characters backspaced are already sent on the line. if you ever seen a misconfigured terminal, it hints what's going on, like:
user@host$ ls ~/^?^?^?^?^?~/a.out
^? is backspace's control char.
that is ssh watches what you type, not what is on the screen (terminal).
Sometimes it’s ^H. You can use `stty -a` to inspect the current setting (backspace is what’s called “erase” there).