How can it be dogmatic when canon law pertains to discipline and in the scenario you cited there is nothing dogmatic involved other than "changing one's mind on the day of the wedding to try and make a point"?
Necessity is a doctrine, not a discipline (i.e., a cause excusing from obedience to superiors and/or positive laws).
That it is mentiond in Canon law is not because necessity is a disciple, but because as a component of moral theology, it is one of the sources of the canon law.