So, for example, I want to ask — When do you usually do your homework? Should it be 你什么时候（一般/平时）做作业 or 你（平时/一般）什么时候做作业 Crucially, I'd like to know why should it be done the way it should be.
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 > adverb of time 我去年到日本遊玩。 adverb of time > 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 > adverb of time > adverb of place 我在週末經常到公園做運動。 adverb of time > adverb of frequency > adverb of place *我經常到公園在週末做運動。 adverb of frequency > adverb of place > adverb of time
By point 2., only the first two sentences are grammatical. But think closely and their meanings differ. Considering the fact that
到公園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.