I thought of a simple way to protect your base with the current locking system.
You have two rooms, an internal one and an external one. to enter the internal room you need to walk through the external one.
There is a door to enter the house and an internal door between the rooms.
The treasure and the sleeping bag are placed inside the internal room, a temporary storage box is placed in the external room.
The keys for the internal door are kept inside the internal room and they never exit it.
When you respawn, you unlock the door, open it, lock it again and drop the key. (the internal door is still open but locked).
Then you move the stuff from the external room to the treasure room, after that you close the internal door from outside.
Now there is no way to enter the treasure room without respawning inside it.
You can then go outside for normal activities, looted items will be placed in the temporary storage box.
if you die, the external room is compromised but the enemies won’t be able to reach the treasure room.
There are still problems with this approach, an enemy could camp you outside your base, kill you and wait for you in the external room.
The solution is to have three levels of doors on both sides of the house. that way you can still exit and enter the house safely while one door is compromised.