The opinion of the Angelic Doctor is one among many. A number of writers prefer the institution to have happened at the Baptism of Christ in the Jordan, others with the conversation with Nicodemus, and some after the Passion of Our Lord. The dogmatics book of Dr. Ludvig Ott expounds as follows:
The exact time of the institution of Baptism cannot be established from Holy Writ. Theologians are divided in their opinions. Some assign as the time of institution the Baptism of Jesus in the Jordan (Petrus Lombardus, Sent. IV 3, 5; St. Thomas, S. th. III 66, 2; Cat. Rom. II 2, 20); others the conversation with Nicodemus (Peter Abelard; cf. St. Bernard of Clairvaux; Ep. 77), others the promulgation of the mandate of Baptism before the Ascension (Hugo of St. Victor, De sacr. II, 6, 4; Mag. Roland). The first two views are based on the improbable assumption, that the baptism of the Disciples was Christian sacramental Baptism. Against the first opinion we may note above all the silence of Holy Writ; against the second, the external circumstances, in which the word of Jesus on the necessity of Baptism for salvation were spoken. The probabilities are in favour of the occasion in Mt. 28, 19; still the mandate of Baptism does not exclude an earlier institution.
St. Bonaventure (Com. in Ioan. c. 3. n. 19) seeks to unify the various opinions in the following fashion. According to the matter (materialiter) Baptism was instituted when Christ was baptised; according to the form (formaliter) when he rose from the dead and gave the form (Mt. 28, 19); according to the effect (effective), when He suffered, for it received its power from the Passion; according to the purpose (finaliter), when foretold its necessity and its benefit (John 3, 5).
The Blessed Virgin came to being in state of grace due to the Immaculate Conception which was according to the 1854 Apostolic Consitution Ineffabilis Deus "in virtue of the merits of Jesus Christ".