Let $\mathcal{C}$ be a category with pullbacks and let $\mathcal{I}$ be the category $0\to 1$. Then $[\mathcal{I},\mathcal{C}]$ is the category whose objects are morphisms in $\mathcal{C}$ and whose morphisms are commutative squares in $\mathcal{C}$.Similarly, $[\mathcal{I}\times\mathcal{I},\mathcal{C}]$ is the category whose objects are commutative squares in $\mathcal{C}$ and whose morphisms are commutative cubes. We define a functor $P\colon[\mathcal{I}\times\mathcal{I},\mathcal{C}]\to[\mathcal{I},\mathcal{C}]$ which takes an object $$ \require{AMScd} \begin{CD} D @>>> C\\ @VVV @VVV \\ B @>>>A \end{CD} $$ to the unique map $D\to B\times_A C$ from $D$ to the pullback of $B\rightarrow A\leftarrow C$. I want to show that this functor has a left adjoint.
My attempt
First note that $P$ take a morphism
to the morphism $$ \require{AMScd} \begin{CD} D_0 @>>> D_1\\ @VVV @VVV \\ B_0\times_{A_0} C_0 @>>> B_1\times_{A_1} C_1 \end{CD} $$ where the bottom horizontal arrow is obtained from the universal property of $B_1\times_{A_1} C_1$. Drawing some big diagrams show that $P$ is indeed a functor.
I tried to show that for a an object $f\colon X\to Y$ in $[\mathcal{I},\mathcal{C}]$, the category $f\downarrow P$ has an initial object. My first guess was that $$ \require{AMScd} \begin{CD} X @>f>> Y\\ @V1VV @V1VV \\ X @>f>>Y \end{CD} $$ is the initial object, but I am pretty sure that in general, $f\colon X\to Y$ is not in the image of $P$. So now I am trying to show that $$ \require{AMScd} \begin{CD} X @>f>> Y\\ @VfVV @V1VV \\ Y @>1>>Y \end{CD} $$ is the initial object. It is in $f\downarrow P$ since $Y\cong Y\times_Y Y$. However, for any other object $$ \require{AMScd} \begin{CD} X @>f>> Y\\ @V1VV @V1VV \\ D @>f>> B\times_A C \end{CD} $$ in $f\downarrow P$, I can't figure out how to define a map $Y\to D$ so that $$ \require{AMScd} \begin{CD} X\xrightarrow{f} Y @>(1,1)>> X\xrightarrow{f} Y\\ @V(f,1)VV @V(h,g)VV \\ Y\xrightarrow{1}Y @>(\_,g)>> D\to B\times_A C \end{CD} $$ commutes. It doesn't seem like such a morphism should exist, so I think I made a mistake somewhere or that $P$ is not a right adjoint. Any help is appreciated

I can't understand why you need a map $Y \rightarrow D$ ?
Indeed, $$\require{AMScd} \left(U = \quad\begin{CD} X @>{f}>> Y\\ @V{f}VV @VVV \\ Y @>>> Y \end{CD}, \text{ }\alpha\right)$$ where $$\alpha = \quad\require{AMScd} \begin{CD} X @>{f}>> Y\\ @V{1_X}VV @V{1_Y}VV \\ X @>{f}>> Y \end{CD}$$
is an initial object in the comma category $(f \downarrow P)$.
To see this, consider an arbitrary object $$\left(L = \quad\require{AMScd} \begin{CD} D @>>> C\\ @VVV @VVV \\ B @>>> A \end{CD},\text{ }\beta\right)$$ where $$\require{AMScd} \beta =\quad\begin{CD} X @>{f}>> Y\\ @V{\beta_0}VV @V{\beta_1}VV \\ D @>>> B \times_A C \end{CD}$$ Consider the commutative diagram $$\require{AMScd} \begin{CD} X @>{f}>> Y\\ @V{\beta_0}VV @V{\beta_1}VV \\ D @>>> B \times_A C @>>> C\\ @VVV @VVV @VVV \\ B @= B @>>> A \end{CD}$$ Use the bottom pullback square to get obvious arrows $Y \rightarrow B, Y \rightarrow C, Y \rightarrow A$.
Check that this defines an arrow $\gamma$ in $[\mathcal{I} \times \mathcal{I}, \mathcal{C}]$ from $U$ to $L$.
This gives rise to a diagram $$\require{AMScd} \begin{CD} X @>{f}>> Y\\ @V{1_X}VV @V{1_Y}VV \\ X @>{f}>> Y\\ @VVV @VVV\\ D @>>> B \times_A C \end{CD}$$ where the bottom square is $P(\gamma)$. Note that the uniqueness property of the arrow $\beta_1 : Y \rightarrow B \times_A C$ into the pullback $B \times_A C$ implies that the bottom right vertical arrow in $P(\gamma)$ is $\beta_1$. Further, the composition of the vertical arrows on the left is $\beta_0$ and that of the vertical arrows on the right is $\beta_1$. This says that $P(\gamma) \circ \alpha = \beta$.
Hence, $\gamma : (U, \alpha) \rightarrow (L, \beta)$ is an arrow in the comma category $(f \downarrow P)$.
Moreover, this is the only such arrow as any arrow $\theta : (U, \alpha) \rightarrow (L, \beta)$ in $(f \downarrow P)$ gives rise to a diagram $$\require{AMScd} \begin{CD} X @>{f}>> Y\\ @V{1_X}VV @V{1_Y}VV \\ X @>{f}>> Y\\ @V{\theta_0}VV @V{\theta_1}VV\\ D @>>> B \times_A C \end{CD}$$ such that the vertical arrows on the left compose to give $\beta_0$ and the vertical arrows on the right compose to give $\beta_1$. Hence, $\theta_0 = \beta_0$ and $\theta_1 = \beta_1$ so that $\beta = \theta$.
Thus, $(U, \alpha)$ is an initial object in the comma category. Hence, $(f \downarrow P)$ has an initial object for every object $f \in [\mathcal{I}, \mathcal{C}]$, so that $P$ has a left adjoint.