Another thing I don't think they realize is that those dumpsters are almost always positioned on the far end of the parking lot, as far away from the restaurant as possible. You can't put a garbage enclosure in that position because:
a.) it would stink to high hell, like you said, and nobody wants to smell rotten food while they're eating;
b.) you have to have room for the waste management trucks to pick up the dumpster, and you can't do that if it's in the middle of the drive-thru;
c.) you definitely can't do that if the drive-thru menu is obstructing the dumpster;
d.) putting it right behind the drive-thru menu is insanity, if a customer opens their window to order food and gets hit with the stench of literal garbage emanating from the McDonald's, they're going to lose their appetite and order less or not at all.