Thanks for the insightful answers. The issue was indeed PGTK, the official build of Emacs 28 works fine. I didn't realize that the version I used was not official, sorry.
However, the same issue still exists in Emacs 29 on Wayland and X (tested on GNOME on both X and Wayland, using emacs-git with PGTK from AUR, which compiles from development master branch), where PGTK is officially supported. Based on your responses, it seems that this is a known issue, but I cannot find any corresponding bug report (I could have missed it though, I'm a bit clumsy with GNU's bug report logs). Should this bug report be moved to Emacs version 29? Or should I report the issue again for Emacs 29?