As mentioned in the comments, we need to fix isomorphisms $\newcommand{\D}{\mathscr{D}}\D_1 \xrightarrow{\sim} \D_1^{op}$ and $\D_2 \xrightarrow{\sim} \D_2^{op}$ for the question to make sense.
In this case one can consider the gluings $\D = \D_1 \times_\varphi \D_2$ and $\D' = \D_2 \times_\psi \D_1$.
Here, $\psi$ is the $\D_2$-$\D_1$-bimodule corresponding to $\varphi$ under the identification $\D_1^{op} \otimes \D_2 \xrightarrow{\sim} \D_2^{op} \otimes \D_1$.

In fact, $\D'$ is nothing but the opposite category of $\D$.  One has canonical isomorphisms
  $$ \D' =  \D_2 \times_\psi \D_1 \simeq  \D_2^{op} \times_\varphi \D_1^{op} \simeq ( \D_1 \times_\varphi \D_2)^{op} = \D^{op} $$
where the last identification holds in general (without the duality assumptions), see Lemma 7.1 in Kuznetsov-Lunts.