A lot of it is probably standards and culture work, like where a user can expect to store files and have them readable by Firefox in this example. So perhaps this is something the GNOME/Freedesktop people could have been interested in and made a difference? Instead we have things like Flatpak, which is good but not the lowest hanging fruit here.
It's also not like Linux is any different with respect to installing random PyPI/npm packages on any other desktop/laptop OS (https://xkcd.com/1200/), so I'm not sure anything desktop Linux does here would change the fact that installing random software from the internet may be a bad idea sometimes ;)
Granted, I'm viewing this as far easier than the sandbox "fake file system" approach? Firefox would be able to see the file exists, most likely, but just not have read rights to it. Yes, you can have some things it can't list, but I would expect that to be low on probability to want to attach to an email?
Linux desktop environments had the chance to set a precedent here where software could for example have had a directory named after the application under the user's home, and use subuid to access files. That is simply an example, but would be a backwards compatible way to create a shared culture how Linux desktop software operate, and easen a transition where desktop software could be limited to "their" own directory.
Instead they squandered this chance by focusing all effort on moving dotfiles around (.config was such a waste of energy where we the heated debate could have been about something more useful, such as the above). Now we have Snap and Flatpak which both try to solve a culture problem (where we store our files) with technical solutions (bind mounts! modal gui:s! popup dialogs!). These will not improve the situation. In the best case it will train users to click "Yes" more, which we know not to help security.