I'm pretty sure the captain outranks the pilot, it would be the pilot disobeying the captains order, which is mutiny.
I would have assumed that the captain is the master of the ship, and the pilot is there to provide guidance.
I would have guessed that if the pilot provides guidance that places the ship at risk the master is then responsible if he follows the advice without recognizing the danger.