The ECU does have RAM capability, it uses it to store fault codes for one. Also the ECU has a permanent power supply to maintain that memory. When you "reset" the ecu it switches to a base area of the map which is safe and allows the car to start. Once its running it takes input from the various engine sensors and uses that data to switch, if necessary, to other areas of the map to adjust, for example to fuel octane rating.
You are basically right in saying the ECU can't self learn as that would imply that it can constantly re-write its own map according to conditions, but Toyota programmed a very broad spectrum map with enough scope to allow for things like BPU tuning. If the ECU sees these conditions every time it is switched on, it will "remember" that and go directly to that area of the map in future.
It is also mapped to allow for variations in sensor input (eg my temp sensor might give a slightly different voltage at 75deg than yours) The ecu can adjust for this and again, "remember" the input its getting. That is why the engine runs slightly rough after an ECU reset as it is re-adjusting from its initial state and compensating for the inputs it sees.
So basically it cannot self-learn, but it can compensate, within Toyotas set of pre-programmed parameters, and remember that next time the engine is running.