The command is run against the Shard object obtained here. If the waitForReadConcernImpl is running on a configsvr secondary, then Grid::get(opCtx)
>shardRegistry()>getConfigShard() returns a ShardLocal instance. Then the appendOplogNote would be ran using the DBDirectClient agains the local node (secondary), which will fail.
We need to ensure that the appendOplogNote is ran against the replica set primary.