Remove support for computing recursive memory usage from memusage.h, making it more easy to plug in other functions.
Furthermore, move the computation of memory usage of core data structures from primitives/*, to reduce its dependencies, specifically on boost.
Should fix #6441.