Hi, teachers. Please help me.

'Most of us when we have seen houses which were picturesquely situated, and wore a look of unusual beauty and comfort, have felt a desire to know who were the people that lived in them.'

The sentence above is in a reference book for improving reading ability in English.

When 'the people that lived in them' is changed into 'they', I think 'who they were' is the correct word order. So I don't understand why it is not 'who the people that lived in them were', but 'who were the people that lived in them.'
Strictly you are right, but in long utterances like this, the verb gets so far away from the subject (who the people........were) that it is clearer to invert the word order.
Thank you very much.