This is not a proper answer but it comments on various aspects (including "the why"), brings some anecdotes, and it is too long for a comment.
in English, there is even the word 'churchyard'. it means that the usual place to be buried was the yard of a church, even for the poor. Separate large cemeteries are a more recent development, when the population was larger and it become not wise to bury everyone on the churchyard due to sanitary reasons (and also land cost: churches are usually in urban areas; cemeteries may be build on the outskirts of cities on cheaper land).
Brazil, in XIX century, still had a lot of churchyard burials.
About burying inside the church, It does not stink if it is done properly, and even in the middle ages they knew how to do it properly. The problem is that not everybody does it properly, and then it was necessary to disallow it as usual practice. It is obviously more expensive to do it properly, so it is another reason why richer people could be buried inside while the poor went to the churchyard.
Even today, modern saints are buried inside churches, and bishops are still buried in cathedrals, and I have never seen complaints about foul smelling. Fatima has the remains of the 3 shepherds (and Lucia got there not long after death) and bishops are buried in the wall around the presbytery.
It makes a lot of sense for small communities to pray where your older relatives are buried, or to want to be buried where you know your descendants will habitually pray. Why to be buried in a large cemetery where people will go only on the day of the dead (November 2 feast as of today calendar), when you could have your loved ones seeing your tomb and perhaps remembering to pray for you often? How will I get out of purgatory if nobody prays for me? It is amazing to me that people do not get that. when I die I really want less stupid eulogies and more praying.
Also note that only saints can be buried below the altar or in the presbytery floor. Moreover, every catholic altar has a saint relic under it, (today too, it is a requirement to consecrate an altar), even if it is a physically small one, such as a bone fragment.
So, people wanted to be buried closer to saints, and tombs closer to the altar were more prestigious, even if really it is quite superstitious and being buried closer to a saint it is not different than being buried anywhere. Moreover, even if one is not superstitious, the altar is the focal point of the building. What is cooler to tell your neighbor: "grandpa is buried close to the altar" or "grandpa is buried in this shadowed corner behind the last collumn"?
It is also interesting that many European monasteries were confiscated by the state and are museums or administrative buildings today. It is hard to know if old bodies were removed or not, it is a case-by-case issue. In University of Coimbra, I used to go to the administrative office for my academic register and pay tuition every semester, and it was in a former cloister, where monk-professors from the XVIII century were buried. I have no idea if the bones are still there, but we waited in line over the tombs of old professors..
A final anecdote: Bernini, the sculptor, after having built the tombs of many cardinals, was given the option to build his own tomb, in whatever side chapel he would choose, or any legally allowed place inside the church, and his cardinal friends would pay for it. Instead of building an elaborate tomb at a side chapel, he chose to be buried right outside of the presbytery (only saints in the floor of the presbytery), on the stairs, and right on the path that the priest must walk from the sacristy to the altar. So, to this day, every time a priest says mass at the basilica, the priest walks over his tomb and see his name. If the priest wants to pray for him...
Here is pic: