Add host initialization via factory function.

This overcomes bad_weak_ptr in shared_from_this() called from ctor.