First, your presentation seems slightly muddled. I think you are arguing the following:
Let $I$ be a nonzero ideal in a Dedekind domain $R$. Then $I$ admits a factorization into primes $I = \mathfrak{p}_1^{a_1} \cdots \mathfrak{p}_r^{a_r}$. Now you observe that (for instance by the Chinese Remainder Theorem, or Artin-Whaples approximation) there exists an element $x \in R$ such that for all $1 \leq i \leq r$, $\operatorname{ord}_{\mathfrak{p}_i}(x) = a_i$. Finally you want to claim that $I = (x)$. (I hope I am understanding correctly.)
The problem is with the very last step: it need not be the case that $I = (x)$. You have enforced that for all $1 \leq i \leq r$, $\operatorname{ord}_{\mathfrak{p}_i}(x) = \operatorname{ord}_{\mathfrak{p}_i}(I) = a_i$. But what about all the other prime ideals of $R$? The Chinese Remainder Theorem does not say that you can find such an $x$ which is divisible by the given set of primes to prescribed multiplicities and is not divisible by any other prime ideals of $R$: indeed, as you have noticed, this is necessarily false in any Dedekind domain which is not a PID.
Nevertheless the argument above does prove something. In fact it proves several things:
1) ("Moving Lemma") Given any nonzero ideal $I$ in a Dedekind domain and any finite set $S$ of nonzero prime ideals of $R$, there exists $0 \neq x$ in the fraction field $K$ such that the fractional ideal $(x) I$ is not divisible by any $\mathfrak{p} \in S$.
This implies:
2) If $R$ has only finitely many prime ideals, then it is a PID.
In fact it also implies:
3) If all but finitely many prime ideals of $R$ are principal, then all prime ideals of $R$ are principal and thus $R$ is a PID.
Fact 2) above is a standard exercise in this subject. For some reason 3) is not: it seems to have first been recorded by Luther Claborn in the 1960's: see Corollary 1.6 here. I "rediscovered it" a few years ago when teaching a course on algebraic number theory. To better appreciate the result, note that the ring $\mathbb{Z}[\sqrt{-3}]$ has infinitely many prime ideals, exactly one of which is not principal. But it is not a Dedekind domain, since it is not integrally closed in its fraction field.