Generalization of cosmological attractor approach to Einstein–Gauss–Bonnet gravity