Merging basically has three separate parts. One for general options flags (those that aren't plugins and presets), and one each for presets and plugins.
The env options merge on top of the root config, so in this example sourceMaps: true overwrites the root false, but the root's comments: false also still in effect, since nothing in env overrode it.
For plugins and presets, they essentially merge by name (in reality identity), so if you specify options for a plugin in env, and that plugin is already in the root, it'll overide it with the options from env. The unique plugins from the root and env will just get joined and you'll end up with three plugins total.