The phrase has an evolving history. Its origins lie in the idiom "good fences make good neighbors", which is to say when you draw the lines in a relationship clearly then the involved parties are less likely to accidentally violate the expected rules.
This is still a pretty common idiom, however, "mending fences" or its derivative "fence building" has a somewhat different meaning. These expressions rather mean repairing broken relationships. This may be by re-establishing boundaries, but not necessarily, it specifically means re-establishing the relationship.
The idiom is a little misleading, what you are rebuilding is the relationship rather than the tool that facilitated the relationship, however idioms and etymology are not an exact science.
See this interesting article:
Here is Wiktionary on the phrase itself.