There is apparently a thing called xdg-desktop-portal.
https://wiki.archlinux.org/title/Xdg-desktop-portal
xdg-desktop-portal offers a way for Flatpak applications to integrate with the desktop. It can allow applications to open URL's, share your screen and more. Depending on the implementation for your desktop there is a confirmation dialog before the application is able to access some portals.
https://github.com/flatpak/xdg-desktop-portal
xdg-desktop-portal works by exposing a series of D-Bus interfaces known as portals under a well-known name (org.freedesktop.portal.Desktop) and object path (/org/freedesktop/portal/desktop).
The portal interfaces include APIs for file access, opening URIs, printing and others.
I had never heard of this before but today I installed an AppImage for a program called ImHex and the file/folder selector buttons did nothing! But it was apparently because it uses xdg-desktop-portal for that. Anyway, I installed xdg-desktop-portal and xdg-desktop-portal-gtk from ppm and everything worked just fine after that without me having to do anything else.