What you are suggesting achieves the needed end result, but with a lot of unnecessary computations, compared to C++ code that would achieve the same.
Creating an entirely new struct means allocating memory for it, and then copying it over to the map when adding. For smaller structs (i.e. several ints packed for convenience), this is tolerable. Some other structs can be thousands of bytes long, and manipulating just a specific several bytes in them shouldn’t mean re-creating thousands.