Fixes pillar namespace merging not preserving order when replacing keys

This should fix issue #9216