Self-supervised Synthetic Pretraining for Inference of Stellar Mass Embedded in Dense Gas