It is always helpful if in your post you can state which version of TM1 you are using, as quite often the behaviour that you are asking about can change between versions.
In this case what you are seeing is the behaviour that, on loading the cube, writes 0 values to the cells that are calculated. In version 10.1 this behaviour can be controlled with the configuration parameter
RulesOverwriteCellsOnLoad.
I do not believe that your use of UNDEFVALS is contributing to this. However you should be aware that if you use UNDEFVALS in a rule and then either remove it or delete the rule then its effect persists until the server is shut down and restarted.