Apple has a support doc on backing up iCloud data with a less than ideal recommendation for macOS Notes.app backup …
To copy notes, open the Notes app at iCloud.com. Copy the text of each note and paste it into a document on your computer, such as a Pages or TextEdit document. Save the document to your computer. To export your notes as PDF, open the Notes app in OS X Mountain Lion or later. Select the note, then click File > Export as PDF and choose a location.
Maybe Automator could make this scale, but I’ve never had much luck with Automator.
There’s a better approach that, oddly, Apple used to recommend …
Select View > Show Folders.
Create a new folder called Notes Backup in the On My Mac section of your folders list.
Select one or more notes from your All iCloud folder. Holding the Option key down, drag the notes into the Notes Backup folder. A green plus icon should appear as you're dragging the Notes to the new folder. This creates a copy of your iCloud Notes on your computer.
If you have an iCloud section in your folders list, but not an On My Mac section, you will need to create one.
In System Preferences, select iCloud. Deselect Notes.
Open Notes. Select File > New Folder. Name your folder Notes Backup. Create a new note in that folder as a placeholder. Quit Notes.
In System Preferences, select iCloud. Select Notes.
Open Notes. You should now see a section for iCloud and a section for On My Mac. Follow the instructions above for making a local backup of your iCloud Notes.
For this to work you need to enable the “On my Mac Account”. That may be disabled on most Macs and I suspect Apple would like to get rid of it. Which is perhaps why it’s no longer part of the backup support doc. In any case this does work on El Capitan, it does scale, and it enables restore.
If you ask Google how to backup Notes.app, the AI presents this as a “pre-answer” above all web page results. Google’s AI does better than Apple’s support documentation team.
Apple needs a better backup/restore solutions for all of its iCloud data, especially Notes.app, but for now this helps.