Nope, LXD always overrides config keys wholesale, there is no merging possible between profiles and containers.
The raw.* keys would also be the hardest to do this with as LXD doesn’t know what makes a valid LXC config. Some keys can only be specified once in a LXC config, some can be specified multiple times but then act as multiple entries in a list, some others need to be reset to empty prior to being set again, …
An option in this case may be to just add a unix-char device with major=42 and minor=23 to your container, this will effectively cause LXD to do that lxc.cgroup.devices.allow and so get rid of that difference between your two container configs.