What if a Catholic magistrate (judge, jp, or similar official) in the course of his official duties was called upon to perform a civil wedding of a couple where at least one was Catholic?
The magistrate can exercise his or her civil duties. However, he (even if a deacon) or she does not act in the name of the Church in that capacity. Consequently, no canonical marriage is created. Certainly a moral perplexity is created, but I will not address that.
A dispensation from the bishop is not needed if the non-Catholic belongs to a church that has valid trinitarian baptism, the priest just needs to give permission for a mixed- marriage.
Only a local ordinary can give this permission (c. 134 §2 tells us who local ordinaries are.) Unless the priest is a local ordinary or unless such a power has been delegated to him, he cannot give this permission (c. 1125).
they would HAVE to go through the Tribunal and get an annulment
Usually bishops delegate the power to investigate “lack of canonical form” marriages to someone at a tribunal, but it is not necessary. Actually, the prenuptial examination can suffice for this, and a tribunal process is not required at all.
However, for the sake of safety, it is normally someone with canonical training or expertise who is designated for the investigation, and given the authority to declare that the marriage is invalid. Since tribunals have people with canonical backgrounds who deal with marriage law anyway, it is often most convenient for them to conduct the investigation.
This declaration of fact has several points(*) but it is an administrative rather than a judicial act of power. Judges on tribunals exercise judicial power. (*At least one party was bound to the canonical form by virtue of being Catholic, the form was not dispensed from, the form was not observed, there was no subsequent validation by the Church, and there is no other provision in law that would make the marriage valid. When marrying an Eastern Orthodox according to the sacred rite of an Eastern Orthodox Church, a Catholic can marry validly but illegally without a permission for mixed religion and a dispensation from canonical form though.)
Sometimes establishing a “canonical lack of form” case is simple. Sometimes it is not.
We do prefer the term “declaration” or “decree” of “nullity” over “annulment” though. In secular use, “annulment” suggests that something that was originally valid was made invalid. That, of course, is not what tribunals of the Church do. They declare certain marriages as having never been valid at all.