Riemann's moduli and Dedekind's modules: any connection?

The concept of a moduli space goes back to Riemann's count of $3g-3$ (or $3p-3$, in older notation) coordinates to describe Riemann surfaces of genus $g$ when $g > 1$. See the bottom of p. 33 here, where Riemann introduces the term Moduln and writes multiple times on later pages about Anzahl der Moduln (number of moduli/parameters/coordinates). This was in 1857.

The 19th century gave rise to other similar-sounding terms: modular functions, modular forms, and the modular group $\text{SL}_2(\mathbf Z)$. As far as I am aware, these terms were introduced in work of people like Dedekind, Fricke, and Klein in the 1870s-1890s, and is related to Dedekind's creation of the term Modul for a lattice (in Euclidean space). Lattices in $\mathbf C$, after suitable scaling normalization to the form $\mathbf Z + \mathbf Z\tau$, are closely related to $\text{SL}_2(\mathbf Z)$, and modular functions and modular forms are related to the action of this group on the upper half-plane (and modular forms can be thought of as certain homogeneous functions on the space of lattices).

My question: is there any reason (through inspiration perhaps, if not for precise technical reasons) to expect Dedekind's term was inspired specifically by Riemann's term?

This question is an attempt to get some clarification on my answer to the MathOverflow question here.

Dedekind explained his choice of "modul" in a footnote with reference to Gauss's congruences, not to Riemann's work, see Episodes in the History of Modern Algebra (1800-1950), p. 79. In 1863 Dedekind published posthumously Dirichlet's Lectures on Number Theory, and Dirichlet defined for $a=sk+r$:"In what follows we shall say that $r$ is the remainder of the number $a$ relative to the modulus $k$", see Siebeneicher's Residues: The gateway to higher arithmetic. Dedekind's point apparently was that the congruence relation is determined by a set, a subset of $\mathbb{Z}$, just as his lattice moduls are subsets (additive subgroups, in modern terms) of $\mathbb{C}$.