"This discussion of Jesus as the beginning of the new temple in replacement of the old in Matthew 21 may also be the best context within which to understand Matthew 27:40, where, in virtual repetition of 26:21, those mocking Jesus say, 'you who are going to destroy the temple and rebuild it in three days, save Yourself! If you are the Son of God, come down from the cross' (See parallels in Mark 14:58 and 15:29). Then, after Jesus 'yielded up his spirit' on the cross, Matthew discloses that 'the veil of the temple was torn in two from top to bottom, and the earth shook; and the rocks were split, and the tombs opened; and many bodies of the saints who had fallen asleep were raised' (Matthew 27:50-52."
Irony is neatly woven throughout this passage. Jesus is mocked because he said that he would tear down the temple and rebuild it in three days, and at virtually the same time Matthew tells us that Jesus actually was in the process of destroying the temple when he died.... Christ was recreating the temple in himself so that it would finally fulfil its world-encompassing purpose."
-G.K. Beale, The Temple and the Church's Mission