Is Flatten() layer in keras necessary?
With GlobalAveragePooling2D, only one Feature per Feature map is selected by averaging every elements of the Feature Map.
e.g. if your global average pooling layer input is 220 x 220 x 30 you will find 1x1x30 output.
It means that you are finding a global representative feature from every slice. That is Global Average Pooling.
No, this isn't specific to transfer learning. It is used over feature maps in the classification layer, that is easier to interpret and less prone to overfitting than a normal fully connected layer.
On the other hand,
Flattening is simply converting a multi-dimensional feature map to a single dimension without any kinds of feature selection.