I had two separate profiles, and I clicked sync on one of them, and now they've both merged. All my notes from both are now on both profiles. Is there any way to reverse this and prevent it from happening again?
You cannot reverse the process, but you could delete all existing notes and restore them from a previous backup. Please check https://joplinapp.org/plugins/plugin/io.github.jackgruber.backup for instructions on how to use the backup plugin (which should be installed and activated by default).
When it comes to the issue itself, in general, you cannot use the same cloud account to sync multiple profiles. This applies to other services like Dropbox, OneDrive, etc. as well.