Goldman Sachs’s stock has benefited from rate-cut expectations, a boom in IPO activity and a bet on one of the hottest areas of the lending market.