Settings: Ensure fields are overriden and not merged when using arrays

In the case you try to put two settings, one being an array and one being
a field, together, the settings were merged instead of being overridden.

First config file
my.value: 1

Second config file
my.value: [ 2, 3 ]

If you execute

settingsBuilder().put(settings1).put(settings2).build()

now only values 2,3 will be in the final settings

Closes #6887
Given that the changes that you made also apply to objects (the `else` branch), I'd also like to have tests that check what happens when replacing a single value with an object, an object with an array, etc.