This is true that your whole data loses if you use recovery mode for restoring. As in recovery mode, your iPhone is restoring itself from the start, so it erases the data. That’s why always remember that the use of iPhone recovery mode is not that safe, so use it only when there is an utmost requirement and no other method is helping. One can also keep all backups before using Recovery mode.