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 Arbuthnott Knox (1963). “University and Anglican sermons of Ronald A. Knox: together with sermons preached on various occasions”