Emergence of local magnetic moments in doped graphene-related materials