Similar Items: Quantifying resilience in non-autonomous and stochastic Earth system dynamics with application to glacial-interglacial cycles