Instead of calling `count()` (to first find out whether a key is in the map) and then `operator[]` (to get the value to the passed key, or default-construct one if not found), use either `find()` or `emplace()``
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/22896 | core#22896]]