If you're counting on wayland to sandbox arbitrary code execution, you're getting in trouble.
Flatpak is providing the actual application sandboxing, but being allowed to talk to the X server is a huge amount of privilege that can't really be restricted.