Consider a cartesian closed category $\mathbf{C}$ and fix an object $B \in \mathbf{C}$.
For any $X$, we have the product $X \times B$ and a projection $\pi_B : X \times B \rightarrow B$. Under the exponential adjunction $- \times B \dashv (-)^B$, this map $\pi_B$ corresponds to its transpose $\overline{\pi_B} : X \rightarrow B^B$.
In $\mathbf{Set}$, it's immediately clear that this is the constant map picking out the the identity on $B$ for every element of $X$. I expect that this generalizes in the sense that $\overline{\pi_B}$ should always be a constant morphism (i.e., a morphism factoring through the terminal object).
I've played around this this a bit, but I'm unsure how to prove it. If it were the case that $\pi_B$ factored as $\pi_B = X \times B \xrightarrow{\bot_X \times B} 1 \times B \xrightarrow{\phi} B$, where $\bot_X$ is the unique map $X \rightarrow 1$ and $\phi$ is an isomorphism between $1 \times B$ and $B$, then the result would follow by taking the transpose of both sides yielding $\overline{\pi_B} = X \xrightarrow{\bot_X} 1 \xrightarrow{\overline{\phi}} B^B$, but I'm not seeing why such a factorization would exist, or if this approach is the right one.
$\require{AMScd}$Your factorization of $\pi_B $ can be proved by considering the following commutative diagram of pullback squares: \begin{CD} X\times B @>>> 1\times B @>>> B\\ @VVV@VVV@VVV\\ X@>>>1@=1 \end{CD} By pullback pasting, the outer rectangle is a pullback as well, hence the top row is $\pi_B $.