I finally got the backup to work after editing it and some trial and error.
At first, I thought removing the problem parts of the RRD data referring to opt2 would be enough, but the error would just move to a different line. I then noticed that the second rrddata node had two nodes for opt2 while the first only had one. I deleted the entire first rrddata section and was able to restore the config.
However, after reboot, the web UI and console got messed up again for a different reason: During restore, pfsense reinstalls the packages, but it doesn't seem to install the right ones. At first I thought it was partially due to pfsense not being up to date. At the time, the current version was 2.4.2-1, but the version downloaded from the site was 2.4.2. Updating to the latest version first didn't make a difference, however. I had to reinstall the packages manually, but that wasn't a big deal because their configuration was restored.
Thanks again to everyone for the help.