Why? He's one of the most likeable athletes not just in basketball, but all sports. He brought unprecedented positive attention to the organization and his salary is more than offset by the number of international endorsements, ticket sales, jersey sales, etc. that was spurred by his name alone.
Not only does the organization owe Yao a debt of gratitude, but so do other players. Shane Battier, Chuck Hayes, Luis Scola, among other Rockets all got shoe deals from Li-Ning or Peak. And they're just the Rockets' players. Baron Davis, Shaquille O'Neal, and even Damon Jones have been signed to Chinese shoe deals.
Yao's athletic, cultural, and monetary impact far outweighs what it costs to keep him. Yeah, he got hurt a lot, but at least he contributed in other ways while hurt. The same can't be said for Tracy McGrady. Or Steve Francis. Or whoever else was supposed to be carrying the team in the past decade.
Yao will be sorely missed by the Rockets and the NBA when he leaves, be it tomorrow or five years from now.