An extension of Attouch’s theorem and its application to second-order epi-differentiation of convexly composite functions