Let $\lambda$ be an infinite cardinal. Consider the Cantor cube $\Delta_\lambda = \{0,1\}^\lambda$. It is a standard fact in topology that the topological weight (= minimal cardinality for a basis) of $\Delta_\lambda$ is $\lambda$. Let $S$ be a zerodimensional compact space of weight $\lambda$ and suppose $s\colon \Delta_\lambda\to S$ is a continuous suriection. Does there exists a closed subspace $D$ of $\Delta_\lambda$, which is homeomorphic to $S$ such that $p_D$ is a homeomorphism?

The following construction is due to Pashenkov (see "Extensions of compact spaces", Soviet Math. Dokl., 1974): Let $X=2^\omega$ and $Z=X \times 2^X$ with product topologies everywhere. Define an equivalence relation on $Z$ by $$(x_1,y_1) \sim (x_2,y_2) \Longleftrightarrow x_1=x_2 \land y_1(x)=y_2(x) \mbox{ for all } x \in X \setminus \{x_1\}.$$ Let $\hat{Z}$ be the quotient space $Z / \sim$ and let $s: Z \to \hat{Z}$ denote the quotient map. Among other things, Pashenkov shows that $\hat{Z}$ is zerodimensional of weight $2^{\aleph_0}$ and that $s$ is an irreducible map (i.e. there is no proper closed subset of $Z$ on which $s$ is still onto $\hat{Z}$). Thus we get a counterexample to your question by taking $\lambda=2^{\aleph_0}$, $S=\hat{Z}$ and noting that $Z$ is homeomorphic to $2^\lambda$. 


I think there is an error in the question. For this to be right, $S$ must necessarily have a subspace homeomorphic to $\Delta_\lambda$. That's not true in simple cases like $\lambda = \omega$, $S$ a convergent sequence. 

