I think cropping everything that is outside of a square that is -625 to 625 from spawn should cover basically everything. 625 as a coordinate in the nether is 5000 in the overworld, and nothing is built outside of that radius in the overworld which would cover all of the portals.