On the optimal control of opinion dynamics on evolving networks