Optimal index and averaging principle for Itô–Doob stochastic fractional differential equations