I agree with HK. Churches have been used in many ways throughout history. Some of the wealthy used them for status. For example, Donated stained glass window with family name on plaque next to it. ( I think the current buzz-word for it is "virtue signaling.")
Some were used as a market place in the middle of the week. Some used as concert halls. Most have been tied to politics in one way or another. Medieval Bishops acted as defacto governors and judges in their regions.
Some were pagan sites taken over by Christians in power politics. (Co-opting.)
Pilgrimages as mentioned above. Along with that, there have always been vendors and businesses that catered to religious travelers. So, as you approach the Vatican and think it is "unholy/annoying/exploitive" to be solicited by tour group operators, t-shirt and souvenir knick-knack sellers, etc. - just remember that these business practices have been going on for centuries and you are having an authentic pilgrimage experience.