Hi. This is to everyone who still have the same problem as to not able to change the apple id while updating or installing the app when it prompt you to. I have the same problem when my co worker ask me for my help. She had an iphone 6 plus and was trying to backup to her new iphoneX. Everything seems fine until she had trouble installing one of her social app (wechat). It prompted her to input the password from an account that's not from her and she couldn't change the apple ID from that prompt screen. I've checked her Apple ID account log in from settings and I tried login out and in again but with same situation. She told me her friend had help her setup her iphone6plus and install the wechat app but it was with her friend's apple account. She had been using the app and signed in with her own apple account on the phone since. So I would assume (like previous ppl who had commented before) that the app was linked to her friend's account because it was installed on that phone while her friend's apple account was link to that phone. Then she signed in with her own apple account but technically the app is still linked to her friend's account. I don't think this is a flaw. I think its to protect app developers themselves. If the app cost money, it would make sense to make sure the app you are trying to use, you had actually paid for it, or had permission for it and not sharing paid app (unless family account sharing) to other ppl.
So with that in mind, I found a solution (at least it worked for me). I deleted the app with her account signed in. Then I log out of iTunes & App Stores account. next I proceed to go to app store and download the app. And finally you will be prompted and be able to input your apple ID and password. Problem Solved and the app will always be linked to that account. Hope that solves a lot of ppls problem. CHEERS!