I'm not sure if i'm understanding documentation correctly here:
https://docs.opnsense.org/manual/unbound.html#advanced-configurations
QuoteSome installations require configuration settings that are not accessible in the UI. To support these, individual configuration files with a .conf extension can be put into the /usr/local/etc/unbound.opnsense.d directory. These files will be automatically included by the UI generated configuration. Multiple configuration files can be placed there.
But Opnsense config file downloaded from System > Configuration > Backups does not have this custom .conf file i placed in that folder.
The text may not be overly explicit, but that is the general approach: not adding configuration blobs into config.xml.
These file-based overrides are good for writing (worst case) custom plugins with which are easy to restore if you know what you are doing (plus the benefit of having a file history for changes if you use e.g. git to store the code/files).
Cheers,
Franco