As you mentioned, this has been taken from the original implementation, at least for BERT. I am not sure about the others because IIRC RoBERTa removed the NSP objective so it was not pretrained with a sentence classification head.
It is worth noting that, again if I recall correctly, BertForSequenceClassification’s head is* pretrained, whereas e.g. RobertaForSequenceClassification isn’t.
cc @thomwolf Do you remember how classification heads were implemented when the original implementation was not pretrained on such objective? Also please correct me if my statement above is incorrect.