Looking back at Tim Cook’s public appearances in the last few years makes the standoff with the government look almost inevitable.