Pausing an editor script while waiting for input like the built in dialog

When writing a custome editor you can use EditorUtility.DisplayDialog and it pauses your method while waiting for user input.

My question: is there a way to do this with a custom editor window of some kind?
I suppose I could write a specific callback pipeline but I’d like to figure out something a bit more generic for multiple use cases.

Yeah no luck here I guess…