I highly suggest that you go see a doctor or a psychiatrist as those are the signs of some mental health issues. Though every person has their respective coping mechanism, what you exhibit is something strange and unusual that requires medical attention. Since you also mentioned that you find difficulty in coping for your losses, then I think it is better if you just avoid gambling at all.
In general, every person has their respective methods in order to cope for their loss. While others may exhibit normal behaviours, other have difficulty in coping and accepting defeat. If that is the case, then preventing and avoiding gambling would be the better method in order to address and prevent these issues.
I sort of understand that logic, it is an introvert situation that only other introverts would understand. Do not imagine "locking yourself in the room" like some psycho deal where we want to get out but we locked ourselves so we can't type of punishment stuff. I have everything I need in my room, and I am pretty happy here and there are no triggers that will make me feel bad here.
So when I feel bad, about anything, I just go into my room, get a book, put a cup of tea, read that book and go into a dream world where I imagine I am the protagonist of that book, and I will ignore all my problems and not face them. This does help immensely and I feel better about it.
It's like people are experiencing this kind of situation too. It is like an urge that you want to spend all of your money just to recover your loss and it will affect your emotion that will turn into depression. If someone is really addicted to gambling, it cannot be controlled easily and will surely spend the last money thinking that they will gain profit even though it's the opposite.
Avoiding loss is the number priority so, it would be much better to have a strategic plan and know that game. I think best strategy is to have a quota when spending funds on gambling like $10 each every game and if it loss then change tactics until you will get more winning than losing.