Elanco Animal Health agreed to buy Bayer’s veterinary drugs unit in a cash and stock deal valued at $7.6 billion, creating the second-largest maker of medicines for pets and livestock and expanding Elanco’s reach online.