Suppose $R$ is a commutative ring, and $S \subset R^{n\times n}$ is an $R$-module. We are given $H_0,\dots,H_n \in R^{n\times n}$, and we know that for all $r \in R$, $$H_0 + r H_1 + \dots r^n H_n \in S$$ The question is: when can we conclude that $H_i \in S$ for all $i=0,1,\dots,n$ ?

Clearly this is true when $R = \mathbb{R}$, because we can choose real numbers $r_0,r_1,\dots,r_n$ and write: $$ H_0 + r_i H_1 + \dots r_i^n H_n \in S \qquad \text{for $i=0,1,\dots,n$}$$ The corresponding Vandermonde matrix $V$ is invertible provided the $r_i$ are distinct. Now take a linear combination of the left-hand-sides of the above relation, using coefficients provided by the ith row of $V^{-1}$. Since $S$ is closed under linear combinations, we conclude that $H_i \in S$, as required.

The same argument won't work for a general commutative ring, but is the result still true? If not, what constraints must be imposed on $R$ to make it so?