Langlands, in his Antwerp II article, was the first to show that the zeta function of a modular curve is exactly the product (well, some of the $L$-functions are in the denominator) of $L$-functions of modular forms (previous results of Eichler, Shimura, Kuga, Sato, Ihara showed the equality up to finitely many factors). He used a comparison of the Lefschetz trace formula and the Arthur–Selberg trace formula to accomplish this. This set up a basic approach to proving that zeta functions of Shimura varieties are products of automorphic $L$-functions which Langlands spent a few papers developing (check out the section on Shimura varieties of his "complete works" website here). This approach involves knowing something specific about the structure of the points mod $p$ of a Shimura variety. The paper of Langlands and Rapoport at the above link is where the Langlands–Rapoport conjecture on the points mod $p$ is first spelled out carefully, but there are other places to read about it (in English! and improved/simplified) such as several of Milne's papers such as his article in Motives II or his article in the Montréal proceedings (which, incidentally, are the proceedings of a conference pretty much whose sole purpose was to prove the zeta function of the Shimura variety associated to a unitary group in three variables (a *Picard modular surface*) is a product of automorphic $L$-functions) (the book is called *The zeta functions of Picard modular surfaces*, edited by Langlands and Ramakrishnan), and Kottwitz's JAMS article which begins with a historical overview.

The modularity theorem, as first suggested by Taniyama, was in terms of $L$-functions. Basically, he said that if Hasse was correct and the $L$-function of an elliptic curve had analytic continuation and satisfied a functional equation then the inverse Mellin transform of the $L$-function of an elliptic curve could very well be a weight 2 modular form (see Shimura's article on Taniyama). The formulation in terms of a modular parametrization came from Shimura's work in the late 50s and 60s on constructing quotients of Jacobians of modular curves attached to modular forms, since some of those quotients were indeed elliptic curves over **Q** (whose $L$-functions matched up as they should). So, perhaps one could say that modular curves come up in Shimura–Taniyama because, if Hasse's conjecture that the $L$-function of an elliptic curve has analytic continuation and functional equation is true, then the inverse Mellin transform of it is a differential form on a modular curve.

Modular curves/forms were interesting to mathematicians way before the 1950s. Poincaré, for one, studied them, but that's a bit far back in time to be my area of expertise.