It doesn't do to say that heresy produces the development of doctrine, because that annoys the theologians. But it is true to say that as a matter of history the development of doctrine has been largely a reaction on the Church's part to the attacks of heresy.
Ronald Knox