A month before Sarvshreshth Gupta died, he tried to quit his job as an analyst on one of Goldman Sachs Group Inc.’s most prestigious investment-banking teams. “I desired that he should complete his one year at Goldman Sachs, learn something about corporate life and then decide,” Gupta’s father wrote. Goldman Sachs let Gupta come back and offered him access to counseling services, according to two people with knowledge of the matter who asked not to be identified discussing personal matters.