Twitter Inc.'s former head of product Daniel Graf announced Friday on the social platform that he was leaving the company—about a month after he was demoted.