I asked the same question a while ago on Meta Stack Overflow, and the answer I got is because the flag and close dialogs need to get a lot of information from the server, here are some examples:
- How many close votes/flags the user has cast that day, to know if they are allowed to cast any more and if yes how many.
- If you have already flagged/voted to close that post recently, because if that is the case you're not allowed to do it again.
- If the post is deleted, to know what flags should be available (only the "in need of moderator intervention" flag is available on deleted posts) or if you should be allowed to close it (you can't vote to close deleted questions).
- How old the post is, to know if it's too old to be migrated.
- (flag dialog only) If the post is closed, to know if the "should be closed" flag should be available.
- (flag dialog only) If the post has a negative score, to know if the "very low quality" flag should be available.
- (close dialog only) How many users have voted to close the question, to display these numbers.
There may be even more information that the dialogs need. My point is that if someone programs a bot to load the dialogs every millisecond or something, all the above information will need to be downloaded from the server each time the bot opens the dialog, which would be enough to make the site stop working. So the reason to rate limit opening the close/flag dialog is to prevent bots from overloading the server by loading the dialog too often.