There is a way around it, but I've yet to learn how to impliment it.
For example, my phone is running the latest AOSP Android 14, and Discord has a way to attach and save files. I have noticed though that when you go and select a file like from Downloads to attach into Discord, it uses the android built-in file manager that's in system, and not anything that is built into the application.
Perhaps that's the difference. Android itself has to show you and brows the files, and it then passes over a URI or something in which your app can use to go pull the file directly. That is just a guess, however. That is for attaching a file.
Downloading a file from Discord app, it goes directly into the downloads folder. it has a way to access that. One stark difference though is the older apps would ask you where you want to put the file, the newer versions just put it only in Downloads without any user intervention outside of the usual first-time runtime permission request.
If you took pictures from within the Discord app, it used to go into your gallery/DCIM folder. that changed with newer versions, only putting them within the Discord's private external storage directory. Likely to do with these storage changes.