I’m not sure where the myth that it has only happened twice started–it’s likely because those two instances involved a lot of extraordinary ceremonial fanfare (FYI, the definitive judgment on the IC happened before Vatican I).
At the First Vatican Council, when some bishops wanted to condition papal infallibility on the Pope following some procedure or using some formula, the relator for the Commissio de fide (charged with providing official explanations of Council documents to the Council Fathers) said this could not be done, because there were already so many instances with various procedures or even none at all:
But, most eminent and reverend fathers, this proposal simply cannot be accepted because we are not dealing with something new here. Already thousands and thousands of dogmatic judgments have gone forth from the Apostolic See; where is the law which prescribed the form to be observed in such judgments?
“Thousands and thousands” might be a bit hyperbolic, but the point remains–it has been many times. Throughout history Popes have often intervened to provide definitive judgments in the areas of faith and morals, sometimes definitively condemning long lists of propositions (e.g. Coelestis Pastor of Bl. Innocent XI, Ex Omnibus Afflictionibus of St. Pius V, Unigenitus of Clement VI, Auctorem Fidei of Pius VI, etc., etc.; each condemned proposition is probably considered an individual judgment by the relator above accounting for the high number given) and sometimes definitively asserting a truth (e.g. like those definitions in Benedictus Deus of Benedict XII, Unam Sanctam of Boniface VIII, the dogmatic letter of St. Agatho, the Tome of St. Leo, etc.).
It also bears pointing out that Vatican I does not limit the infallibility of the Church and Pope to those truths revealed by God, which are to be “believed” with divine faith, but also morality (which can be known from reason) and those truths logically or necessarily connected to revealed truth which must be definitively “held.” For example, the definitive judgment on the Church’a power to only ordain men in Ordinatio Sacerdotalis is not a definition of a dogma (properly called) to be believed, but rather the latter category of those to be “definitively held.” St. John Paul II also had similar definitive judgments on moral points in Evangelium Vitae (specifically on killing an innocent person and another on abortion).
There’s no set formula or document category–the Pope merely has to be making a definitive judgment for the whole Church on a matter of faith or morals to be believed or held.