In the most prototypical usage, the verb かかる takes two arguments.
[activity/goal] に [time](が)かかる
As an example, 避難に時間がかかる matches this pattern. [避難まで]に時間がかかる` is the result of substituting the [activity/goal] part with a specific point of time that marks some event. In this particular example, it could be understood as either the beginning or the completion of evacuation.
As a marker of a specific point of time, までに seems more suitable than まで. However, the marked point is not a deadline by which some event has to happen as in the normal usage of までに. After all, 時間がかかる refers to something that naturally happens, not something you have to finish before some deadline. In addition, the meaning of 時間がかかる makes one imagine a state in which something is ongoing. Perhaps for these reasons, に is sometimes omitted as we can see in 辺りから人がいなくなるまで一体何分かかる. To me, 辺りから人がいなくなるまでに一体何分かかる still sounds more correct and natural, though the nuance is subtle. By the way, it could be rephrased to [辺りから人がいなくなるの]に一体何分かかる, which matches the prototype better.
If the [time] part is the concept of time itself, such as 時間, the subject marker が is used. (It may be replaced with は or も, of course.) If it refers to a duration of time, such as 何分, が is usually not used. (は or も may be added.) And this duration may be represented by an end point marked with まで. 避難に[夜中まで]かかる is an example of that, and までに cannot be used in this position.
As for the question of how かかる should be grammatically categorized, I cannot claim to have a definite answer. There is some “meta” property to this verb. Should a passage of time be considered something that takes time? One thing I can say is that 時間がかかっている is a valid expression to describe a state in which some ongoing activity is taking more time than expected. However, this doesn’t necessarily mean it goes better with まで than までに. It’s complicated.