Miamonides wrote the laws of Mashiach at the end of his work. At the end is when we prepare for the next beginning. Every step from the beginning of time is to lead to the coming of Moshiach. This is the primordial vision of G-d in creation.