I am reposting the second question from here (after clarifying it) on the recommendation of user "GH from MO".

Let $b_1,b_2,\dots$ be an enumeration of $\mathbb Q$.

**Question 2:** Suppose I define $$G(x,y) = a_0(y) + a_1(y)(x-b_1) + a_2(y)(x-b_1)(x-b_2) + \dots$$ where the $a_k(y)$ are polynomials in $y$ and $g(x) = G(x,x)$.

Suppose the $a_k(y)$ are not identically zero for $k$ large enough. Otherwise, we clearly get polynomials. Is this the only way to get a polynomial? That is, if $g(x)$ is equal to a polynomial function, then is $a_k = 0$ for $k \gg 0$?