The Google parent’s stock hit a new record after a new AI deal with Apple, pushing its market value above $4 trillion.