I had similar issues scanning dirs when implementing the file manager. there's a problem in the way the fflib manages mounts and indeed, if a mount is done many times on the same partition it goes haywire.
your approach of calling file_to_sectors after scanning the dir is the right approach. if you take out the mount calls in the function itself, it will not work outside the context. consider this a limitation for now as I haven't found a way to overcome this when I was working on the file manager. this issue is part of the original code and I'm not sure it could be fixed but I'll think of something and let you know if I find anything.
Thank you for your feedback. For now it's ok, but if sometime in the future we get a single library for exFAT/NTFS this could be an issue, because it doesn't work the same way as the file_to_sector for ntfs.
I wonder if it's possible to get the sectors without having to mount the device again or maybe make the library recover the previous status so it can continue reading the next entry in the directories (e.g. I'm using recursive directory scanning).