Constructing the topological product space from categorical universal property Let $X,Y$ be topological spaces. I want to construct the categorical product, i.e. the product space, $X\times Y$ using the universal property of products. To be clear, I don't want to construct the product by "guessing", and then use uniqueness of categorical products. I want to directly infer what the space must be.
Now, following Riehl, and assuming the product exists, the universal property gives a bijetion (natural in $A$),
$$
\mathrm{Top}(A,X\times Y) \overset{(\pi_X,\pi_Y)_*}\cong \mathrm{Top}(A,X)\times\mathrm{Top}(A,Y).
$$
Evaluating at the one-point space $*$ and recalling that $*$ represents the forgetful functor $U:\mathrm{Top}\to\mathrm{Set}$, we have bijections
$$
U(X\times Y) 
\cong \mathrm{Top}(*,X\times Y) 
\cong \mathrm{Top}(*,X)\times\mathrm{Top}(*,Y)
\cong UX\times UY.
$$

Bonus question: Is this bijection natural in $X$ and $Y$? A priori, I don't see how, because the outer two bijections are natural isomorphisms of covariant functors, while the middle one is of contravariant functors.

In other words, the underlying set of $X\times Y$ must be (isomorphic to) the cartesian product of the underlying sets. However:

Main question: Does this argument also imply that (the underlying functions of) the canonical projections $X\overset{\pi_X}\leftarrow X\times Y\overset{\pi_Y}\to Y$ are equal to the canonical projections of the cartesian product of sets? In concrete terms, can we conclude that $\pi_X(x,y)=x$, $\pi_Y(x,y)=y$?
Or in excruciating detail, let $f:U(X\times Y)\to UX\times UY$ be the bijection from above, and let $UX\overset{p_X}\leftarrow UX\times UY\overset{p_Y}\to UY$ be the cartesian product projections. Can we conclude $U\pi_X= p_Xf$, $U\pi_Y= p_Yf$?

Riehl skips this detail and goes on to show how the topology on $X\times Y$ now follows from the universal property, which is easy enough (if the projection maps are known!). Of course, the last step then would be to verify that the space we got actually satisfies the universal property, which amounts to an easy exercise in point-set topology.

I'm still just dipping my toes in category theory, so it's propably something obvious going on. This is my very first example of a limit, so I wanted to make sure I understand the subtleties. I'll mention that the example is given right after the definition of limits, so hopefully no higher theory of limits or products is needed, or adjunctions for that matter.
 A: You are correct that Riehl has skipped some details. It’s actually not totally trivia; you’ve stumbled upon something important.$\DeclareMathOperator{Set}{Set}$$\DeclareMathOperator{Top}{Top}$
A functor $U : C \to D$, $U$ is said to preserve limits of shape $J$ if for all diagrams $F : J \to C$ and all limits $(L, \pi)$ of this diagram, the cone $(UL, U \pi)$ is a limit of the diagram $U J : J \to D$. We often use terminology like “preserves products” and “preserves pullbacks” to refer to this notion. Your main question is: does the forgetful functor $U : \Top \to \Set$ preserve products?
In particular, it is possible to have a functor $U : C \to \Set$, a choice of products on $C$, and a natural isomorphism $U(X \times Y) \to UX \times UY$ without $U$ preserving products. Take, for example, $C$ to be the category with 1 object and 1 arrow. Define $U$ to send the single object to $\mathbb{N}$. Then take a bijection $f : \mathbb{N} \to \mathbb{N}^2$; this gives us a natural isomorphism $U(X \times Y) \to UX \times UY$. Nevertheless, $U$ does not preserve products.
Here is an interesting result which I just thought of at this very moment.
Consider a functor $U : C \to D$. Suppose we have some full subcategory $D’ \subseteq D$ with the following property: for any objects $X, Y \in D$, consider the category $D’ / X$, where the objects are pairs $(A \in D’, f \in D(A, X))$. Then $D(X, Y)$, together with the obvious maps, is the limit of the functor $(A, f) \mapsto D(A, Y) : D’ / X \to \Set$. Call this the “limiting condition”.
Note that another (perhaps better) way to phrase the limiting condition is: every object $X \in D$ can be expressed as some colimit over objects in $D’$. Formulating things this way might help with “size issues”.
Now suppose further that for all $A \in D’$, the functor $X \mapsto D(A, UX) : C \to \Set$ is representable. Then $U$ preserves all limits.
Indeed, consider some diagram $F : J \to C$ and some limiting cone $(L, \pi)$. Now consider some $X$ and some cone $\{\tau_j : X \to UFj\}_{j \in J}$. We wish to produce the unique morphism $f : X \to UL$ such that $U\pi_j \circ f = \tau_j$ for all $j$.
We begin by considering the particular case that $X \in D’$. Then take some $Z \in C$ and some natural isomorphism $\theta : D(X, U-) \to C(Z, -)$. Then we have, for each $j \in J$, an arrow $\theta_{Fj}(\tau_j) : Z \to Fj$; it’s easy to see this forms a cone. Then there exists a unique $g : Z \to L$ such that for all $j$, $\theta_{Fj}(\tau_j) = \pi_j \circ g$. By the naturality of $\theta$, this is equivalent to saying that for all $j$, $\tau_j = U \pi_j \circ \theta_L^{-1}(g)$, so $f = \theta_L^{-1}(g)$ is exactly what we’re looking for.
Now we consider the more general case, with no added restrictions on $X$. Given an arbitrary $A \in D’$ and $g : A \to X$, we can define $\kappa_g$ to be the unique arrow $A \to UL$ such that for all $j$, we have $U \pi_j \circ \kappa_g = \tau_j \circ g$. Note that if we have $B \in D’$ and $h : B \to A$, then we have $\kappa_{g \circ h} = \kappa_g \circ h$. Therefore, by the limiting condition, we have a unique $f : X \to UL$ such that for all $A \in D’$ and $g : A \to X$, we have $f \circ g = \kappa_g$.
Now fix $j$. Note that for such an $f$, we have, for all $A \in D’$ and $g : A \to X$, that $U \pi_j \circ f \circ g = U \pi_j \circ \kappa_g = \tau_j \circ g$. Therefore, we have $U \pi_j \circ f = \tau_j$.
Conversely, if we had some $f$ such that for all $j$, $U \pi_j \circ f = \tau_j$, then for all $A \in D’$ and $g : A \to X$, we would have $U \pi_j \circ f \circ g = \tau_j \circ g = U \pi_j \circ \kappa_g$, and therefore we would have $f \circ g = \kappa_g$. This shows uniqueness. $\square$
There are two useful special cases of the above here. The first is the case of $D = \Set$ and $D’ = \{*\}$. In this special case, we see that if $U$ is representable, then it preserves all limits.
The second useful case is the case where $D = D’$. This case says that if $U$ is a right adjoint, then $U$ preserves all limits.
A third useful case involves certain categories known as Grothendieck toposes, but that’s far too advanced to dive into here.
It turns out that both these special cases apply to the forgetful functor $U : \Top \to \Set$. $U$ is represented by the 1-element topological space, and its left adjoint is the functor giving a set the discrete topology.
A: Let us write $f = \gamma \circ \beta\circ \alpha$ as in : $$
U(X\times Y) 
\overset{\alpha}\cong \mathrm{Top}(*,X\times Y) 
\overset\beta\cong \mathrm{Top}(*,X)\times\mathrm{Top}(*,Y)
\overset\gamma\cong UX\times UY.
$$
The map $U(\pi_X): U(X\times Y) \to U(X)$ is mapped to (by the Yoneda lemma) :
$$\forall f\in \operatorname{Top}(*,X\times Y), U(\pi_X)\circ\alpha^{-1}(f) = \pi_X\circ f $$
then to :
$$\forall (f,g) \in \operatorname{Top}(*,X) \times \operatorname{Top}(*,Y) , U(\pi_X) \circ(\beta\circ\alpha)^{-1}(f,g) = \pi_X\circ f\in \operatorname{Top}(*,X)$$
and at last to :
$$\forall (x,y) \in U(X)\times U(Y),  U(\pi_X)\circ f^{-1}(x,y) = x$$
ie :
$$U(\pi_X) = p_X\circ f$$

Bonus question: Is this bijection natural in $X$ and $Y$? A priori, I don't see how, because the outer two bijections are natural isomorphisms of covariant functors, while the middle one is of contravariant functors.

The 4 terms are covariant functors in $X$ and $Y$ and the bijections are natural.
A: After an embarrassing amount of thought (most of it spent on Mark Saving's nice generalization to be fair), I've come to realize that it can be seen quite directly in this case. We had
$$
U(X\times Y)
\cong \mathrm{Top}(*,X \times Y)
\cong \mathrm{Top}(*,X) \times \mathrm{Top}(*,Y)
\cong UX \times UY.
$$
But we know the concrete action of each of these maps. Write $*_z$ for the map in $\mathrm{Top}$ sending the singleton in the one-point space to the element $z$. Then the maps above send $z\in U(X\times Y)$ to
$$
z
\mapsto *_z
\mapsto (*_{\pi_X (z)}, *_{\pi_Y (z)})
\mapsto (\pi_X(z), \pi_Y(z))
=: f(z).
$$
And so,
$
p_Xf(z) = \pi_X(z),
$
meaning $U\pi_X=p_Xf$. How hard could that be haha?

This is probably equivalent to SolubleFish' answer in hindsight.
