I’m not an emacs user but that gives me strong powershell vibes! (Not a derogatory remark.)
Welcome to the Emacs shell
/tmp $ set-variable `x 6; echo $x
6
/tmp $
M-: (term "pwsh") PowerShell 7.4.0
PS /tmp> set-variable `x 6; echo $x
6
PS /tmp>
Disturbing.