Pecco Bagnaia won the Ducati Race of Champions, a reminder of his talents on his first notable comeback since a drink driving incident.