Let $(G,p)$ be a Bayesian network* with a leaf (child-less node) $X$, such that there is a root (parent-less node) $Y$ in $G$ which has the same range as $X$. Moreover, suppose that we can "collapse" $X$ and $Y$ without creating cycles: that is, the graph $G'$ which is exactly like $G$, except that all edges into $X$ are redirected into $Y$ and node $X$ is deleted, is acyclic.
Let now $p'$ be the probability function for the collapsed graph $G'$: that is, the probability function that's (i) Markov relative to $G'$, which (ii) agrees with $p$ on all transition probabilities into nodes except those into $X$ and $Y$, and which (iii) satisfies $p'(Y=y|\mathrm{Pa}_G(X))=p(X=y|\mathrm{Pa}_G(X))$ for all values $y$ of $Y$, where Pa$_G(X)$ is the set of $X$'s parents in $G$.
Question: Is $p'\equiv p(\cdot | X=Y)\vert_{G'}$? I.e., is $p'$ the same as the result of conditionalizing $p$ on the claim that $X$ and $Y$ take the same value (and restricting the result to the variables in $G'$)? Suppose here that $p(X=Y)>0.$
I would be extremely grateful for any solutions/tips/pointers!
(* That is, let $G=(\mathbf{V},\mathbf{E})$ be a directed acyclic graph (DAG) with a set $\mathbf{V}$ of nodes and a set $\mathbf{E}$ of directed edges, such that the nodes are random variables and $p$ is a probability function defined over them, which is Markov relative to $G$.)