Use an alternative to the Facebook app that actually respects your choices? There are apps like Tinfoil for Facebook which are basically wrappers around a browser (purpose being to stop FB getting access to the rest of your browsing), which means that as long as the browser takes note of .nomedia this problem won't arise. Note though that I don't know whether it will: there's no reason a browser has to be limited to uploading only media, so it really depends on how the upload interface is coded.
Of course this issue only arises when you are trying to use the FB app to upload something, which is presumably something you don't want anyone else doing with your Facebook account anyway! If you really don't want people snooping through your phone the answer is to not give them access in the first place: a gallery app might respect a .nomedia file but a file explorer won't (its purpose is to look at all files, not just media, so ignoring a .nomedia is the correct behaviour). So anyone who wants to poke through your phone is going to have ways of finding this stuff unless it's in some protected folder as suggested above, which is why I say the real answer is to PIN/fingerprint protect your phone and not give others unsupervised access to it.