Could I replace a hub on a wheel?
Simple answer: yes, but it’s not worth doing. 

Cost of hub, spokes, nipples and having wheel rebuilt will exceed the cost of a new wheel. Even if you re-use the spokes a new wheel will still be cheaper. 

Wheel building requires special equipment, expertise and time to do correctly.