Should words like 一般 or 平时 be put before or after the time reference?
Tl;dr: There is inherent adverbial order in Chinese (point 2.). Sentences with the same adverbs ordered differently can have different meanings (points 3. to 6.).

The correct order is 你平時/一般什麼時候做作業？.

We know for a fact that the 'natural' (perhaps even grammatical) ordering of adverbs depends heavily on the language. Consider the following pair of example:




Sentence
Adverbial order




I travelled to Japan last year.
adverb of place &gt; adverb of time


我去年到日本遊玩。
adverb of time &gt; adverb of place




平時/一般 is an adverb of frequency (not time). Usually we place it right after the subject and before adverbs of time in Chinese, because it is the most generalisable. But do consider the following:




Sentence
Adverbial order




我經常在週末到公園做運動。
adverb of frequency &gt; adverb of time &gt; adverb of place


我在週末經常到公園做運動。
adverb of time &gt; adverb of frequency &gt; adverb of place


*我經常到公園在週末做運動。
adverb of frequency &gt; adverb of place &gt; adverb of time




By point 2., only the first two sentences are grammatical. But think closely and their meanings differ. Considering the fact that 經常, 在週末, and 到公園 are all preceding adverbs (狀語), they modify ALL that follows (even the adverbs after them). In a way, whatever you say first limits the scope of the sentence most.
So in the first sentence, it seems that the speaker is commenting on their habit in general, which involves exercising in the park at weekends. But in the second sentence, it seems that the speaker is commenting exclusively on their habit at weekends, which is that they exercise in the park. (Implying the speaker's habit at weekdays may be different.)

Likewise, if you say 我平時/一般在晚上做作業。, you are commenting on your habit in general. If you say 我在晚上一般做作業。, you are commenting exclusively on your habit during nighttime. Perhaps you are deliberately contrasting this to others' nighttime habit, or what you routinely do during daytime.

In the above example, it seems particularly odd to place 平時, which already specified the generality of time, after a specific point of time in the day. 一般 is relatively weak in temporality, so it is permissible.

Back to your question: in *你什麼時候平時/一般做作業？, it is illogical to knowingly limit your scope of discussion to an uncertain period of time (i.e., 什麼時候) when in fact you are supposed to ask others' habit as a general inquiry.