An important side note: Yes, Wayland is something of a moving target, which in my opinion means that it is better to use the work-arounds rather than trying to "fix" code from the Freepascal side. The latter will almost certainly cause more problems once Wayland either supports it properly or denies its use properly as deprecated.
This remark stems from extensive work on Raspberry Pi's in Wayland mode and all the changes that regularly appear when updating the OS.
Only a couple of months ago I used to switch to X, but note that is no longer necessary in most cases and Wayland is definitely an improvement over X. At least it should be, based on the design model. It also means you need to regularly update your OS.
If it bothers you you can still switch to X of course.