In his book, first encounter of a groups has the following: Define group as a groupoid with a single object. Define category Grp in such a way that objects are $\mathrm{Aut}(G)$ for any group $G$, and morphisms are such that preserves the structure. Then he define a direct product of a group by stating an universal property: given any groups $X$, $A$, $B$ we have a unique morphism $f\colon X\to A\times B$ defined as follows: $f(x) := (a(x),b(x))$, which indeed makes a diagram with two morphisms $a\colon X \to A$ and $b\colon X \to B$ commute.
My question is: what is the formal definition of an ordered pair here? We are not working in set theory, so obviously we can't take $\{\{a\}, \{a,b\}\}$ as the notion (moreover since not all morphisms will be "small enough" to be a sets, so we can have a singleton of it. So what is an ordered pair then? I searched through nlab, and it says that ordered pair is basically an object of a product in category theory, but we use it to define product then, which is cyclic.
Please note that as Aluffi states in the book, the definition of a group as a groupoid with a single object is a joke. Of course, he himself mentions, the "joke definition" is valid, and a reasonable way to think about groups, but you're better off taking a more "down to earth" approach first. Namely, use Definition II.1.2 which Aluffi calls the "official" definition. Thus, everything in Chapter II should be taken with respect to Definition II.1.2, the official definition.
Note, the joke definition subsumes, and is strictly more general than the official definition, precisely because we're not restricted to sets.
Likewise, Aluffi does not technically define group products by first stating a universal property. Rather, he first defines product of groups in the traditional set-theoretic sense after Proposition II.3.3, and then in Proposition II.3.4 he demonstrates that the set-theoretic product he defined satisfies the universal property of products as discussed in I.5.4.
Moreover, as I mentioned above, Aluffi is working with Definition II.1.2 as his definition of group, and therefore it is a set, and ordered pairs make sense.
Of course this still leaves open the question of how to define a product of groupoids more abstractly. Though the objects and morphisms of an arbitrary category may not be sets, they are still a class. In this case, one can still form ordered pairs of classes in much the same way one does for sets. From there, one defines products of categories as mentioned in the comment by freakish, and ultimately groupoids, following the same process.