This is the diagram for the question from my friend's test. Each of pipes 1 to 5 behave independently of each other. Each pipe is open with probability $p \in (0, 1)$. Water will be able to pass through a particular pipe if and only if the pipe is open. It is given that pipes 2 and 3 are open. What is the conditional probability that water seeps through the layer of quartzite into the layer of sandstone?
For this problem, I calculated $P(\text{Water seeps through the quartzite layer}) = 2p^2-p^3$ (each of the two distinct paths of pipes are open with probability $p^2$ and both paths of pipes are open with probability $p^3$) and $P(\text{Pipes 2 and 3 are open}) = p^2$ which is giving me the conditional probability to be $2-p$. However this is impossible. I am making a mistake somewhere. Can someone please provide a detailed solution to this problem?

There's no need to divide by $p^2$, as the probability $2 p^2 - p^3$ is the desired conditional probability, as you've already assumed an event space where pipes $2$ and $3$ are open.
For a path to exist given that pipes $2$ and $3$ are open, we first note that pipe $5$ must obviously be open, which occurs with probability $p$. Furthermore, either (1) pipe $1$ or (2) pipe $4$ must be open. The probability of event (1) is $p$, as is the probability of (2). But, as you have pointed out, the probability of the disjunction "(1) or (2)" is not $p + p = 2 p$ but rather $2 p - p^2$ (since we have overcounted the case where both paths are complete). So, the (conditional) probability that there is a path between $W$ and $S$ given that pipes $2$ and $3$ are open is $p (2 p - p^2)$.
If you want to do it your way, the numerator should be the probability that there is a path between $W$ and $S$ and pipes $2$ and $3$ are open. (Note that this is subtly different than the question of the probability that there is a path between $W$ and $S$ given that pipes $2$ and $3$ are open.) For this, we must have that pipes $\{ 2, 3, 5 \}$ are open (probability $p^3$). Then, we must have either pipe $1$ or pipe $4$ open, which has probability $2 p - p^2$, as you can check. Thus, the probability is $p^3 (2 p - p^2)$. The desired conditional probability is
$$P = \frac{p^3 (2 p - p^2)}{p^2} = p (2 p - p^2)$$
which is the same as what was obtained in the "intuitive" approach.