It must happen before the Second Coming of Christ.
However, modern Dispensational Theology has taken unrelated passages of scripture and welded them together to produce their system of interpretation.
This has produced tremendous confusion.
Many modern Christians have never heard anything else.
There will be no future time when God will remove the Church from the planet and then go back to the Old Covenant system with the modern State of Israel.
Daniel's 70th week occurred about 2,000 years ago when the Gospel was taken "first" to Daniel's people as Christ commanded.
It started at the Baptism of Jesus and ended when Stephen reviewed the whole history of Israel and was then stoned. After that the Gospel was taken to the Gentiles.
The AOD occurred during 167 BC and Christ warned His disciples that something similar would happen during 70 AD. This is revealed by Luke 21:20-24.
Therefore, Daniel 9:27 and Matthew 24:15 have nothing to do with 2 Thessalonians 2.
A rebuilt Jewish temple would be what is described in Revelation 2:9.
It would be a synagogue of Satan, instead of a temple of God.
Christ and His Church is now the temple of God.
.