Can hubs last forever? In theory, could a bicycle hub last forever if you kept overhauling it (and getting new spokes and rims and etc.)?

I'd like to know about all the hubs, but what really interests me is whether or not cassette hubs and front hubs can be overhauled over and over and last 'forever'.
If the shell is aluminum and we're talking about the whole thing and not just the bearing races, the literal answer is flat out no, because aluminum doesn't have a fatigue limit. It will crack eventually. 

As to the question of can a hub bearing race, real or hypothetical, last literally forever in any kind of use, that's the kind of question everyone likes speculating about but I think you need a bearing engineer to begin answering, so I'll say I don't know.

In practical terms the answer is most cups/cones with enough preventative overhauling can be made to last a very, very long time, much longer than they normally do. In my experience for a nicer hub with very hard, precisely made races it's more or less indefinitely. I've tried to keep more modest hubs going the same way and wound up wearing them out despite my best efforts, but I'm heavy and ride where it's wet.

There's a side conversation about using ball bearings whose hardness is a good match for the races, which is a topic usually glossed over in bike shops. I don't know the details but I've come to suspect it can matter quite a bit in the long-term lifespan of a hub.

How much flex the axle is experiencing is also a pretty major factor over time.

All freewheeling mechanisms wear out eventually as far as I know.