After running the script I notice that the that the XDG_SESSION_TYPE turns to X11.
Since I didn't see anything that should directly cause this change (and since the consensus seems to be on Wayland as more secure) it must have happened inadvertently due to permissions or something else.