Just to confirm, I've also verified this against GTK+ Version 3.24.34:
GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34,
cairo version 1.16.0) of 2022-06-11
Emacs is built as follows:
./configure' '--prefix=/home/hdiags/hdiags/spack/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-11.3.0/emacs-master-tvikd2njjgseq47ywpa5zrlksnz3pylz' '--with-x' '--with-x-toolkit=gtk' '--with-gnutls'
For avoidance of doubt, the issue still occurs when the emacs is started as:
# No server currently running
emacs -q --fg-daemon
emacsclient -F '((name . "foobar") (title . "foobar-title"))' --create-frame
xprop reports:
WM_CLASS(STRING) = "emacs", "Emacs"
WM_ICON_NAME(STRING) = "foobar"
_NET_WM_ICON_NAME(UTF8_STRING) = "foobar-title"
WM_NAME(STRING) = "foobar-title"
_NET_WM_NAME(UTF8_STRING) = "foobar-title"
Using a previous version of emacs (26.3), the same steps produce:
WM_CLASS(STRING) = "foobar", "Emacs"