When constructing options for Server::executeReadWriteCommand, a writeConcern option is ignored if the pipeline does not contain a write stage (e.g. $out, $merge). It may make more sense to either prohibit specifying a writeConcern if the pipeline does not write or ignore it earlier (e.g. unset it in the constructor).
Either change would require changes to some tests within CollectionFunctionalTest, which currently use a non-writing pipeline with a writeConcern option.