Generators detected by homomorphisms to a prime cyclic group
Let $\ell$ be prime and $G$ a compact totally disconnected topological group such that every quotient by an open normal subgroup is an $\ell$-group. For any $S\subseteq G$, if every homomorphism $\chi:G\to\mathbb Z/\ell\mathbb Z$ with open kernel and $\chi|_S=0$ is zero, then the subgroup generated by $S$ is dense in $G$.
Moreover, let $h\ge0$. If the set of homomorphisms $G\to\mathbb Z/\ell\mathbb Z$ with open kernel is finite of cardinality at most $\ell^h$, then there exist $h$ elements of $G$ generating a dense subgroup.
An $\ell$-group means that every element has order a power of $\ell$. No Hausdorff hypothesis is imposed.