Lets make this very simple. There is a gain envelope and a volume envelope. The volume envelope controls the track fader and the gain envelope doesn't.
The gain envelope can be automated and the volume envelope can be automated. Now, when you enable the WRITE Mode and let sonar record your movements, it records is as the volume envelope, not the gain envelope.
Understand?
Cj