Recently I encountered this sentence in the novel 四畳半神話大系:
The context is that the speaker is a god, who is chastising the main character for not knowing who he is, despite living near his shrine.
The ～ておきながら construction here confused me. I know the usage of ～ながら for contrast as in "although", "despite", etc. But I didn't understand what ～ておく was doing here, which I know to be typically used for doing something in advance or doing something temporarily or for now, none of which seem to fit this context of 住んでいる。
Googling brought me to this video https://www.youtube.com/watch?v=DWJrYqAm3Co, as well as this Q and A https://hinative.com/questions/9047129 in which I discovered that apparently ～ておいて・～ておきながら are grammar patterns that I have never heard of, which also serve the function of contrast.
So I can more or less understand their use now, but what confuses me is that I cannot find much other "official" references to these grammar patterns. And this use of おく to me does not really align with its typical usages.
I wonder if someone can help me better understand the function of おく here. And it would be nice if someone could point me to these grammar points referenced in something more concrete like a textbook or something.