'would' and 'used to' are interchangeable. We can use either while talking about PAST HABITS.
I used to visit my sister twice a week.
I would visit my sister twice a week.
Can we use 'would' in a subordinate clause followed by a main clause with 'would'?
When he would see me, he would wave.
Or should there be past tense in the subordinate clause?
When he saw me, he would wave.
Note that it was his habit to wave but I'm not sure if 'seeing' can be considered as a habit.