It's not only the code base. It's employees, servers, processes, data...
Even if you get twitter for free, you still need to pay to run it.
One reason Mastodon and others have trouble is that people don't want to follow random people, they want to follow the same people they did on Twitter. It's their community.
Certain communities did make a successful switch, like Apple and Tech journalist communities, but not a lot of other communities.
This seems to be taken as given, but how specifically would you expect someone to simply monetize the social graph? Just because data exists doesn't mean that anyone wants to pay for it.
As for the value of the brand itself, we could say the same thing about Yahoo in 2010.
You can really pull a lot of useful data on someone by just looking at their follow choices, self-identification, and reply/retweeting behavior. And that's before you add all the information Twitter maintains on things like profile views or video plays, or the consistency of entity identification in tweet content etc. I can give you very specific kinds of demographics like 'people who enjoy tweets about dogs and football but not cats or politics.'
Augmenting these lists with Twitter's data might improve/expand the lists bur won't create much extra value imo, because the demand side won't change.