Fix resetting scoped config defaults

It would write an empty object for the parent key when there were no other objects in the parent key.

Closes #4175