For a particular general formula, yes, there are only finitely many triples $(z,a,b)$ with rational $z$. For $\color{blue}{p = 2:}$
$$\begin{aligned}
\frac{1}{\pi} &= \sum_{n=0}^\infty \frac{256^n \big(\tfrac{1}{2})_n \big(\tfrac{1}{4})_n \big(\tfrac{3}{4})_n}{n!^3} \frac{An+B}{C^{n+1/2}}\\
\small{\color{brown}{where,}}\;&\\
A &= \sqrt{C}\big(1-2\beta)\tfrac{1}{p}\sqrt{d}\\
B &= \frac{\sqrt{C}}{\pi}\Big(\,_2F_1\big(\tfrac{1}{4},\tfrac{3}{4};1;\beta\big)\Big)^{-2}-\tfrac{1}{2}\cdot\tfrac{1}{4}\cdot\tfrac{3}{4}\cdot\tfrac{1}{p}\cdot\frac{256\sqrt{d}}{\sqrt{C}}\,\frac{_2F_1\big(\tfrac{5}{4},\tfrac{7}{4};2;\beta\big)}{_2F_1\big(\tfrac{1}{4},\tfrac{3}{4};1;\beta\big)}\\
C &= r_2(\tau)\\
\beta &= \frac{1-\sqrt{1-\frac{256}{r_2(\tau)}}}{2}\\
\small{\color{brown}{and,}}\;&\\
r_2(\tau) &= \left( \Big(\tfrac{\eta(\tau)}{\eta(2\tau)}\Big)^{12}+ \Big(\tfrac{\sqrt{2}\,\eta(2\tau)}{\eta(\tau)}\Big)^{12}\right)^2\\
\small{\color{brown}{with,}}\;&\\
\tau &= \frac{1}{4}\sqrt{-d},\quad \text{or}\quad \tau = \frac{1}{4}\big(2+\sqrt{-d}\big)
\end{aligned}$$
This formula generalizes the well-known one by Ramanujan and depends only on a single parameter, $\tau$, and ultimately on the discriminant $d$. Thus, it is easy to test various $d$ to see which yields rational $C$.
Examples:. Define,
$$h_2(n) = \frac{(4n)!}{n!^4} = \frac{256^n \big(\tfrac{1}{2})_n \big(\tfrac{1}{4})_n \big(\tfrac{3}{4})_n}{n!^3} = 1, 24, 2520, 369600, 63063000,\dots\tag1$$
which is sequence A008977.
Let $d = 148 = 4\times37$, with class number $h(-d) = 2$, and $\tau = \frac{2+\sqrt{-148}}{4}$. Note that given the prime-generating polynomial $F(n) = 2n^2-2n+19$, then $F(\tau) = 0$. Then,
$$A = 85840i,\quad B = 4492i,\quad C = r_2(\tau) = -14112^2$$
$$\frac{1}{\pi} = 4\sum_{n=0}^\infty h_2(n) (-1)^n \frac{37\times580n+1123}{(14112^2)^{n+1/2}}$$
Let $d = 232 = 4\times58$, with class number $h(-d) = 2$, and $\tau = \frac{\sqrt{-232}}{4}$. Note that given the prime-generating polynomial $F(n) = 2n^2+29$, then $F(\tau) = 0$. Then,
$$A = 844480\sqrt{2},\quad B = 35296\sqrt{2},\quad C = r_2(\tau) = 396^4$$
$$\frac{1}{\pi} = 32\sqrt{2}\sum_{n=0}^\infty h_2(n) \frac{58\times455n+1103}{(396^4)^{n+1/2}}$$
which is Ramanujan's famous formula alluded to earlier.
Remarks:
- The formulas for $p=1,2,3,4$ are given in this article Ramanujan's pi formulas and the hypergeometric function. They are my own formulation, but you can re-derive them from the more complicated versions by the Borweins or by Guillera.
- Using $p=2$, I count only $12$ formulas with rational $C$, but some of the $A,B$ involve a square root. They're in Pi Formulas and the Monster. This is an older work, so is not as stream-lined as the previous article.
- Ramanujan's formulas have been generalized for $p>4$ by using other well-defined integer sequences similar to $(1)$. See Ramanujan-Sato series.