Have you tried the suggestions in https://ghostty.org/docs/help/terminfo#ssh? I don't know what issue you may be experiencing but this solved my issue with using htop in an ssh session.
That is essentially the 2nd solution recommended. I think ghostty could do this itself as a hack. If the target binary is ssh (heuristic, but, ok), inject TERM=xterm-256color into env of the child process at launch.
I guess it isn't a huge deal to have every user to modify their ssh_config instead, but it's an ergonomic pain point for many new users.