For CPA security it is actually enough that the first scheme, i.e., $\pi = (gen, enc, dec)$ is CPA secure.
Lets define the CPA game of a general scheme $\pi = (Gen, Enc, Dec)$ against an adversary $A$ as follows:
- We sample $(pk, sk) \leftarrow Gen(1^\lambda)$, and send $pk$ to $A$.
- $A$ outputs messages $m_0$ and $m_1$.
- We sample $b \leftarrow \{0,1\}$ (a random bit), and $c \leftarrow Enc(pk,m_b)$ (here I add the public key as a parameter to $Enc$, to make the key explicit)
- $A$ outputs a bit $b'$.
We say $A$ wins if $b = b'$, and the scheme is IND-CPA secure if $A$ has at most negligible advantage.
Now, let $\Pi = (Gen, Enc, Dec)$, $\pi = (gen, enc, dec)$ and $\pi' = (gen', enc', dec')$ be the schemes you suggest in your question. Assume there exists an adversary $A$ with non-negligible advantage against $\Pi$ (i.e., proving $\Pi$ is not IND-CPA secure). Then we can construct an adversary $B$ against $\pi$ as follows:
- On input $pk$ from the CPA game $B$ samples $(pk', sk') \leftarrow gen'(1^\lambda)$, and sends $PK = (pk, pk')$ to $A$.
- When $A$ outputs $m_0$, $m_1$ $B$ forwards these messages to the CPA game.
- On input $c$ from the CPA game $B$ samples $C \leftarrow Enc'(pk', c)$ and sends $C$ to $A$.
- When $A$ outputs $b'$ $B$ outputs the same bit.
Now you see that $B$ wins the CPA game against $\pi$ if and only if $A$ would have won the corresponding game against $\Pi$. This means that since $A$ has non-negligible advantage against $\Pi$ and $B$ has provided $A$ with messages exactly as in the CPA game against $\Pi$, it follows that $B$ must also have non-negligible advantage against $\pi$. This, however, contradicts $\pi$ being IND-CPA secure, so no such $A$ can exist. I.e., $\Pi$ is also CPA secure.
Note the security of $\pi'$ really does not matter here.
A similar proof might be possible for CCA security, but I have not attempted one.