it is actually not needed because firefox checks itself whether it runs on wayland and activates it accordingly.
I am setting it in ~/.config/environment.d/envvars.conf
MOZ_ENABLE_WAYLAND=1
and constantly switch between X11 and wayland without issues.