A desire to secure leadership for the future is driving midsize firms to resume merger talks and strike deals that were largely put on hold in the wake of the pandemic, consultants say.