Trackhouse's Raul Fernandez won the season-ending Valencia GP on an all-Spanish podium ahead of Ducati's champ Marquez.