Apples have more vitamin-C than, say, pears. So if it is correct that vitamin-C is "good for the immune system", it would be better than a pear, for instance.
Vitamin-C is not the only thing said to be needed by the immune system, though. Frequently zinc and iron are mentioned. Some berries have lots of iron and vitamin-C.
does vitamin-c really boost your immune system?
Though, the quote you gave is very old (?) and I doubt the "immune system" was a concept when that saying originated. The immune system is not the only part of the body which needs nutrition.
Apples are probably one of the most widely known and available types of fruit, hence the choice for that old saying you quoted.
It is common knowledge that they used to have barrels with apples on ships hundreds of years ago, to prevent the crews from getting scurvy.
Their nutrient vs. calorie ratio is certainly better, in average, than what the e.g. victorian poor folk apparently ate: bread, butter, potatoes, beer, and tea. (Potatoes contain more of certain minerals, though).
what the poor ate
Apples, and some berries, too, are rather aggressive on the teeth due to their high acid content, though. I wouldn't eat them all day - as a matter of fact, I used to, and it did harm my enamel. It was copious amounts over some years, though. That famous "five a day" suggestion would not come near what I ate.