How to export/backup Notes in macOS in one go
I copied the three files NoteStore.sqlite, NoteStore.sqlite-shm, and NoteStore.sqlite-wal from ~/Library/Group Containers/group.com.apple.notes of one Mac to another and my notes appear there now. All my notes were there, albeit half a day out of sync.