While struggling with fixing my sync I notice that the export I made before the mess started does not seem to contain all notes.
After import to a fresh installation of Joplin I have 736 notes, while in the encrypted folder there are more than 2600 md files.
I suppose that is because Joplin keeps track, not only of notes, but also of completed tasks and deleted notes. So it seems if you need to keep version history the right thing to do is backup the joplin directories.
Something else to note about “export/import as backup/restore”; if you restore by importing from backup, the restored notes don’t retain their original id, they will be assigned new id’s. Ids are internal identifiers, however they are exposed to the user in several contexts. I understand why it works this way technically, however it is something to be aware of.