A first-principles method to calculate the critical temperature gradient for the onset of the ion-temperature-gradient mode (ITG) in linear gyrokinetics is presented. We find that conventional notions of the connection length previously invoked in tokamak research should be revised and replaced by a generalized correlation length to explain this onset in stellarators. Simple numerical experiments and gyrokinetic theory show that localized spikes in shear, a hallmark of stellarator geometry, are generally insufficient to constrain the parallel correlation length of the mode. ITG modes that localize within bad drift curvature wells that have a critical gradient set by peak drift curvature are also observed. A case study of nearly helical stellarators of increasing field period demonstrates that the critical gradient can indeed be controlled by manipulating magnetic geometry, but underscores the need for a general framework to evaluate the critical gradient. We conclude that average curvature and global shear set the correlation length of resonant ITG modes near the absolute critical gradient, the physics of which is included through direct solution of the gyrokinetic equation. Our method, which handles general geometry and is more efficient than conventional gyrokinetic solvers, could be applied to future studies of stellarator ITG turbulence optimization.