There's two standard responses to this point.
One, that the risk of that happening should have been obvious at the start, so it's silly to feel burned.
Two, if you do build some add-on feature to someone else's platform then the challenge is to do it so well that the company behind that platform offers to buy you. Tweetie was so good it could not be ignored, Twitter loved it, they wanted an app, buying it would save them the effort of writing their own, plus talent is scarce. Thus, they get bought.