What is basis of multifunctionality of "master glands" in the endocrine system?
It would seem to me that in the examples that you have listed that proximity to necessary input is the overriding logic behind gland geography. Take the hypothalamus as the first example. This gland receives input from diverse regions of the brain from the amygdala and hippocampus to the retina and brainstem. The brain can tweak levels of various releasing hormones entering the  hypothalamic-hypophyseal portal veins in order to produce a response that is appropriate to the situation perceived by the brain. It makes sense to have all of these co-located because they are all receiving input from the brain. Similarly, it makes sense to have all of cells that are uptaking the releasing hormones close-by to protect these vital peptides from degradation in the systemic circulation. Their collectively unique circumstance makes sharing a specialized vasculature a logical choice.

The pancreas is a good example of the importance of cross-talk within some endocrine tissue. Within the islet, alpha, beta, and delta cells are feeding back on each other to get the balance of insulin and glucagon just right. To whit, glucagon secretion provides a paracrine signal for insulin secretion. This makes sense because the body knows that once glucagon is released the blood sugar will soon rise. Ergo, it makes sense to trigger some insulin secretion as well in preparation. Their co-location makes that possible.

In short, I would say the overriding logic to the placement of each of these glands is their proximity to the necessary inputs and outputs that each of these glands interacts with.