I have the same problem.
user@Mac ~ % sw_vers
ProductName: macOS
ProductVersion: 15.0
BuildVersion: 24A335
My hostname is set to "cupertino" in System Settings > General > Sharing > Local hostname
My zsh prompt is configured correctly:
user@Mac ~ % grep PROMPT < .zshrc
PROMPT='%n@%m %~ %# '
The hostname command just says "Mac"
user@Mac ~ % /bin/hostname -f
Mac
networksetup seems to give the Find My Mac computer name of "MacBook Pro"
user@Mac ~ % networksetup -getcomputername
MacBook Pro
Only scutil LocalHostName gives an "okay" answer to LocalHostName.
user@Mac ~ % scutil --get ComputerName
MacBook Pro
user@Mac ~ % scutil --get HostName
HostName: not set
user@Mac ~ % scutil --get LocalHostName
cupertino