zmsaad, Jworm's answer is totally correct. You asked why, so I'll explain. If you do a few simple tests, you will see how the car's system works.
Also, the issue with Toyotas is not a function of time---nothing happens "after a few minutes"----depending on how you exit and lock your car, the problem either happens or it doesn't.
First, roll down your passenger window, and insert your key in the passenger door and leave it there. Then try these things and observe what happens.
1. Close the door. Reach in through the window and lock the doors with the power lock switch. You will observe that you can unlock them again with the switch whenever you want.
2. Open the door.
While the door is still open, lock the doors using the power lock switch. Then close the door. Reach inside the window and try to operate the unlock switch----it will not work.
3. Close the door. Use the key (not the switch) to lock all the doors. Reach in the window and try to unlock the doors with the switch----it won't work, just like #2 above.
4. Lock the car using either #2 or #3 above----the unlock switch inside the car will not work at this point. Now, reach in the window and move the mechanical lever that unlocks ONLY that one door. Then try the power unlock switch---you will see that it works now.
Hopefully what I'm saying makes sense, and you are closer to understanding why your car only unlocks sometimes. I'll explain further.
---Refer to #1 above. If you close your door first, and lock the car with your aftermarket remote, the unlock function will work 100% next time you want to get in.
---Refer to #2 and #3 above. If you lock your doors before closing them, or lock them with the key, your aftermarket remote will fail to unlock the doors next time.
---Refer to #4 above. There is a wire coming off the doorlock lever, which is called the Unlock Detection wire. People often call it the "child safety" wire, but that term is incorrect, and the wire has nothing to do with the safety of children.
At any rate, if you ground the unlock-detection wire and the unlock-switch wire at the same time, the doors will unlock 100%. But this method is a big time-waster in my opinion---don't bother using it.
So this brings us back to the answer to your original question, and the reasoning behind it:
The wires connected to the key cylinder in the door work 100% of the time, with just two simple connections, and with no extra parts.
Furthermore, when you lock the doors using your aftermarket remotes, the unlocking switch inside the car is disabled, just like Toyota intended it to be.
As an added bonus, when you unlock the car using the proper wires, the domelight will come on too.