When it comes to getting a tenure-track position where one has both a lot of resources and academic freedom to do what one wants to do (so having a tenure-track position in a top university might be more useful because one may get more resources at a top university).
Or in short, when one wants to maximize one's chances of becoming a "top scientist".
There are obviously numerous factors, and "rank/prestige" should not be considered as a factor in itself. That said, the period after one gets a PhD is an extremely important time for building up connections, and those are easier to get at a top university.
- Getting experience at a top university is good for your CV and for you as a researcher.
- Getting more research experience under your belt can increase your chance of getting a job in the future, but there are no guarantees.
A post-doc will give you a chance to write more papers and to find out what topic you really want to do your research on.
Taking the assistant professorship now would get you immediately on the track to full professor, which may be delayed if you spend years doing a post doc.
Working at a non-top university might mean that the students you have access to, for example, as RAs or PhD students, to develop your research vision, will not be as good as at the top university. That said, as a post-doc, you will generally not have access to such students anyway, except perhaps as part of a collaboration.
The pressure to succeed at a top university is much greater than at a non-top university.