It is more huge numbers of people and poor crowd control. The Saudis are simply incompetent.
Any senior cop who is familiar with large events could have told the Saudis that the thousands who had just finished stoning the Devil should be allowed to exit before the next group was allowed to enter. Really, how hard is that? “OK, you guys, you have to hold up for a few minutes while until we’re ready for you!”
Sounds simple enough when you are dealing with civilized people, but that's not the case here. Various groups of Muslims consider themselves superior to other such groups.
If you look up the history of these Hajj stampedes, you will find remarkable similarity on various factions refusing to yield. One of the bigger death tolls had to do with one group walking too slowly through an air-conditioned tunnel built specifically to handle these large crowds. One or more of the groups behind them took umbrage at the pace and created a stampede walking over them.
Put too many MS-13 gangster types in the same area and this type of mayhem is unavoidable.