Regarding timing I don't see it as strange at all. From what I hear Riley was the "coach in waiting" but the OU AD had the sense to keep it a secret. So everyone in high leadership, Bob, and Riley have been preparing accordingly.
Also, Stoops's father dropped dead from a heart attack around his age, iirc. Maybe it's a preventative retirement rather than a reactionary one.
Finally, 18 years is a long time to coach D1. Stoops doesn't need the money and his legacy is solid at OU. Seems like he did it exactly right to me...