Because it is evident that it is a sacrament, what is a sacrament? A sacrament is a holy liturgy. It is the official worship of the church. It is the official prayer and liturgy to glorify the Lord through the celebration of a sacrament. And so for Catholics, the wedding moment is a celebration of a sacrament. Holy things and holy things belong to holy places and to the consecrated places of the church.
Of course, there can be situations of emergency or persecution or others where there is no possibility to celebrate marriage in a church, and it was so in the case of my parents. They were persecuted, and they had to celebrate the sacrament of marriage secretly in a house. But when there is a church, it is more proper to celebrate it there, of course.