I'm not sure we want to do this.  By setting the source InMemoryBucket from either the ours or theirs side into the result, any modification made by the caller to the result NoteMap will also impact the input ours or theirs map.  (Or vice-versa, any later modification to ours/theirs impacts the result.)

Did you add this because removing the writeTree() from asFanout() after the LeafBucket split() broke tests?  If so then I was wrong earlier, we would need the writeTree()... but only if we are reusing the bucket.  So maybe instead its more like:

  if (child == null)
    return;
  if (child instanceof InMemoryNoteBucket)
    b.setBucket(cell, ((InMemoryNoteBucket)child).writeTree(inserter));
  else
    b.setBucket(cell, child.getTreeId());