In the earlier times Egyptians would just bury their dead in the ground than kings and rich nobles wanted something better which led to the rich and royal where buried in mastaba only in the later development of mummification did the Egyptians start to mummy-fy people but it did not take off immediately (surprisingly) slowly the burials became more and more advanced until it became the burials we all know today with the pyramids as for gods what i could find was Anubis and Ma'at were associated with death (and all that jazz)