We know that $K_0(A) \neq K_0(B)$ in general. Take for example, what Handelman pointed out, the full and reduced group $C^*$-algebras of a group $G$ which is not $K$-amenable, i.e. $K_0(C^* G) \neq K_0(C^*_r G)$.

It is fair to assume that we may find an example where $K_0(A)=0$ but $K_0(B) \neq 0$.

If you accept this, then you immediately have a counterexample.

Take $a_0:=\bigoplus_{\mathbb{N}} A_0$ with two distinct closures
$a:=\bigoplus A$ ($C^*$-direct inifinite sum of $A$) and similarly $b:=\bigoplus B$.

Then $a_0$ is dense in $a$ and $b$.

But $K_0(a) = \bigoplus K_0(A) =0$ is finitely generated, and $K_0(b)= \bigoplus K_0(B)$ is infinitely generated.

That is why I am confident that your question is answered to the negative.