TL;DR: It works because the total charge on the ring is equal to the point charge in the center.
Polarization is not just defined for point charges. In general, for any charge distribution $\rho(\vec{r})$ the dipole moment is defined as $$\vec{P} = \int d^dx\ \vec{r} \rho(\vec{r})\tag{1},$$
where $d$ is the dimension of your system. In your case d=2, the plane, but it reduces into a 1d integral becasue you can write $\rho(\vec{r}) = -q \delta(\vec{r}) + \lambda \delta(|r|-R)\theta(y)$. This is just the sum of the
negative point charge at the center and the semi-circle charge that exist only on the upper half plane. Putting this into (1) gives you the answer you already have. Good. As another quick, and easier, example, if we have 2 point charges of opposite sign located at $\vec{r}_1$ and $\vec{r}_2$, then $\rho(\vec{r}) = +q \delta(\vec{r}-\vec{r}_1) - q \delta(\vec{r}-\vec{r}_2)$, and the integral reduces to the sum of these two points giving $\vec{P} = q(\vec{r}_1-\vec{r}_2)$ which is the formula you are familiar with.
Now you are correct about (1) being only well defined when the total charge of the system is zero, that is when $Q =\int d^dx\rho(\vec{r}) = 0$. That is not hard to see, since when defining $\rho(\vec{r})$ one needs to pick an origin, and for the definition of the dipole to make any sense it must be indifferent to this chioce of coordinate system. Let's see how $\vec{P}$ change under such change of coordinates. If we let $\rho(\vec{r}) \rightarrow \rho(\vec{r}-\vec{r}_0)$, that is shifting our coordinate system by some vector $\vec{r}_0$. Then, $$\vec{P} \rightarrow \int d^dx\ \vec{r}\rho(\vec{r}-\vec{r}_0) = \int d^dx (\vec{r}+\vec{r}_0)\rho(\vec{r}) = \vec{P} + \vec{r}_0 Q, $$
and so, for the dipole moment to remain unchanged, the totoal charge $Q$ has to be zero. Notice that in both cases, the two point charges with opposite sign, and the point charge in the center and a semi-circle charge distribution around it, have net zero charge, and so the polarization is well defined.