Asalamu alaykum,
Brother, may Allah make things easy for you. Ameen.
Keep in mind, above all else, that this world is a test. It is temporary and is like a drop of water compared to the vastness of the ocean of the hearafter. We are slaves of Allah. He will try us in ways with his wisdom that is best for us.
As for you mother, she is behaving strangely as though she is ill in some way. The behaviour is out of her control, from what you suggest. If she truly suffering from a psychological condition, then you should strive to have mercy toward her. Be patient with her. Treat her like you would treat any other 'ill' person. They are in need of attention and love.
For example, imagine if there was somebody in your neighbourhood that was famous for being 'insane'. Imagine that he become that way after having lost his son and couldn't handle it. Imagine that whenever he saw a particular guy, he would momentarily assume that he was his son and give him hugs and shower him with his love and be happy that his son is with him again.
Given that scenario, do you think it would be a good move on the part of the guy that is mistaken to be the insane guy's son to harbour ill feelings toward the insane guy? Or would it be better and more praiseworthy for him to show patience and play along during the random times that the insane person behaves the way he does? It's clear that the latter is indeed more beneficial behaviour, for both the insane person and the youth. Good for the insane cos his heart is made to feel good and good for the youth that he is able to learn patience, help a fellow human being out and gain reward in the process.
From what you describe of your mother, her situation is like that of the insane man. She is not able to control herself. The best course of action for you would be to show patience and do as she asks,
just to placate her. It is counterproductive and raises chance of conflict if you argue, talk back etc. There is no point in that. Sometimes people do inexplicable and strange things and the only option left is to ignore and be patient with it.
and a few times i, on purpose dont lock the door and i explain to her each time that i wont lock the door... then she goes like "listen to me and lock the door" then i say "since ur so worried about the lock why dont u lock the door?" she goes like "no i want to c if u lock the door" i say "u know i lock the door everytime bcus ur always there whenever i am leaving the house, so u lock it this time since u care about the lock so much" and it continues until i just leave then she starts hating on me and starts acting rude when i start leaving then i get all confused and feel messed up...
Bro, I say this with respect, what you described here is rude behaviour on your part. If your mother asks you to do something,
Islamically, you're meant do it no questions asked. It's also very rude to talk back to them.
Granted, she is behaving strangely. However, you are her son and she is still older than you. You owe her respect. Like I said, treat her like a person who is 'ill' in some way and bear it with patience. Just do as she says with no questions asked (of course, as long what she asks doesn't go against Islam) and there would be no chance of conflict arising.
Hold your tongue. Don't talk back to her, even if you are in the right. The resulting disharmony is not worth it. Don't give in to your ego, in a bid to prove that she is wrong. Just let it go and be patient.
Our parents are older than us and they will have a bit of an ego too. They won't tolerate being told off by their children and if you do such a thing, it will just create more of a divide. Be patient InshaAllah.
As for the assumed psychological damage that you feel is being done to you - I disagree. There is no real damage bro. Everything happens by the will of Allah and
there is a divine wisdom behind things to happen the way that they do. You are being taught patience. Allah is building your character by testing you and verily we will all be tested.
Compare yourself to somebody else your age that's grown up without a care in the world, everything being given to him etc. He wouldn't be half as good/patient as you. Not since he's used to the easy life so much.
Saying that, don't be prideful of your state. Strive for humility InshaAllah and thank Allah for everything. Good or bad.
Make plenty of dua. It is the weapon of a believer. It is powerful. Just have certainty when you ask of Allah and think of Allah in a good light always. Do it every day.
A tip in being patient with your mother - imagine the nightmare that would arise if something really bad were to happen to her, like she was to get into an accident or be murdered etc. The mere thought of such ill-fortune should soften your heart and want you to make dua for her protection and thank Allah that she is still in your life. Despite her bad qualities, you still love her. Remember that paradise is at the feet of your mother. So strive to be dutiful to her.
Be persistent in striving toward patientce. You will have bad days where you end up losing it and better days where you are able to stay calm in the light of her behaviour. Don't lose hope in the bad times, InshaAllah.