If you want to replace the missing values of class A, taking the average value calculated from the training instances of this particular class A, then you "deviate" from your data set. To avoid bias (which will ultimately block your trained model), it’s wise to use the “replace missing values” function by default, that is, consider the average and mode of all training instances, and not just this particular class.
source share