Topologically protected Casimir effect for lattice fermions