Just a note on this, here the colors are associated with aṅgīrasa, hence with light and the sun. The Vinaya passage and the later one are not identical, but surely the similarity is close enough to be a precursor.
Less obvious is that the colors also mostly occur in Chandogya Upanishad 8.6.1:
atha yā etā hṛdayasya nāḍyastāḥ piṅgalasyāṇimnastiṣṭhanti śuklasya nīlasya pītasya lohitasyetyasau vā ādityaḥ piṅgala eṣa śukla eṣa nīla eṣa pīta eṣa lohitaḥ
Then these veins connected with the heart are each filled with a thin liquid, coloured reddish-yellow, white, blue, yellow, and red. The sun there also has these colours—reddish-yellow, white, blue, yellow, and red.
Here they are explicitly connected with the sun.
The only difference with the Buddhist flag is that mañjeṭṭha is replaced with piṅgala. But these two colors are similar, and in fact there is a divergence of interpretation as to the exact hue (see the wikipedia page on the Buddhist flag).
The idea of these passages is that the sun extends its rays to encompass the world, as the heart sends veins to the body, and the light (tejas) of the sun is in fact connected with the veins. This is a quasi-organic expression of the identity between the self and the cosmos. The idea is that the colors of the sun are the same as those of the nadi, i.e. the veins or channels of the body.
Here, it would seem, the blood is red, other fluids are yellow or white, perhaps the blue is the oxygen-depleted blood, which can appear purplish.
If it is protested that the sun is not blue or white, the referent is the sky at dawn, which is when the Buddha was enlightened. It would seem that this set of colors was recognized as a solar spectrum of cosmic significance in the broader Indian context.