Companies and investors turn to M&A as they adjust to economic shifts driven by the rise of AI