foo is receiving a mutable reference and it can't modify the map without those changes leaking out permanently to the caller: https://go.dev/play/p/DXchC5Hq8o8. Passing maps by value would have prevented this by copying the contents.
It's a quirk of C++ that reference args can't be replaced but pointer args can.
The point is that the local variable referencing the map is a different entity than the map itself. Foo gets a copy of that local variable, and the copy references the same map object.
And the fact that C++ references can be used for assignment is essentially their whole point, not "a quirk".
Go is always pass-by-value, even for maps [0]:
In contrast, C++ references have different semantics [1]: [0] https://go.dev/play/p/6a6Mz9KdFUh[1] https://onlinegdb.com/j0U2NYbjL