I believe there is, but please wait until @laurent gives his input before you do/try anything.
It should be ok to switch to a local filesystem sync target on android and then you would have all notes in the directory you specified.
You can’t access the local data on Android, because it is private to the application and not accesssible from the outside (filesystem). The only workaround is using a file system sync target, or maybe even any sync target other than WebDAV, but I’m not 100% sure, thus let’s wait for Laurent’s opinion.
On Android, before opening Joplin, disconnect the wifi and mobile data. Make sure that the phone has no internet at all so that it doesn’t sync and wipe out the local data too.
If you are root on your phone, indeed the best is to first make a backup of the database file. You can even use this database file on the desktop to get your notes back.
Otherwise, it’s like @tessus said - you need to pick a new sync target (but especially not WebDAV if that’s what you were using) and sync to it. I feel filesystem sync can be a bit risky due to permission issues, so I’d go for Dropbox.
Also if you have some really important larger notes maybe it’s best to “share” them from the program first so you have them saved somewhere (of course taking all the precautions not to sync in the meantime with the empty target). It’s really bad that (usually) people don’t have enough permissions to even back up their phones and the (non-Apple) manufacturers aren’t providing really good tools to do it.