The editor needs a chance to update its UI in order to show anything in the console window. So if your script is blocking the main thread… well there’s nothing the editor can do except wait for your script to finish.
So you actually need a coroutine for this. The problem here is the standard coroutine doesn’t work in editor scripts, as they need to hook into some update function.
The solution is to create your own coroutine solution for the editor. There are a few sample EditorCoroutine source code out there, like this or this.
(Note to people in the future (hi!) – if these links are dead by the time you read this, just google “EditorCoroutine” to find other and similar hits)