In the old days, terminals were hardware devices (CRT screen, keyboard, serial interface, later LAN) and worked differently - e.g. VT100 gave different characters than an xterm. Control characters like bold and colours were very likely to use different control codes. Software terminal emulators are the same - try VT100 or xterm or whatever and see if the \e\w\a disappears.
The thing is, it does the same with Windows Terminal. Most of the example I looked at, they used this and it worked fine when they show it in “YouTube”.
Like most things, it works fine in the example, but when I try it…
FWIW, using Windows 11 built in ssh.exe to HAOS on port 22222 works fine and still correctly sets up the terminal. Maybe this is related to the Add-in. Technically, PowerShell is running the ssh.exe built in to Windows, just like cmd.exe would do.
You can add -vvv to the ssh command line and get debug output. You should see debug related to the terminal setup:
debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug3: This windows OS supports conpty
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
debug3: Successfully set console output code page from:65001 to 65001
debug3: Successfully set console input code page from:437 to 65001