Make HasTraits pickleable

The main change is storing method names instead of functions in `trait_dyn_inits`.
These functions were failing to pickle.
Merge pull request #5554 from minrk/pickle-traitlets2

Make HasTraits pickleable