Engineering of robust topological quantum phases in graphene nanoribbons