U.S. companies returned a record amount of cash to shareholders through stock buybacks and dividend payouts in the first quarter, continuing a trend that has helped drive the stock market’s record-setting rally.