Who are gratified when the sacrifices/yajna are performed by the demigods? Like when humans make sacrifices they gratify demigod (like Indra, Agni, etc.). I mean Indra is a god that had performed a hundred sacrifices. And also there is in scriptures that Brahma also had performed various sacrifices. So, for whom these sacrifices are performed by them.
Who are gratified when the sacrifices are performed by the demigods?
Themselves, and also Brahman.
The Madhu-Vidya is a meditation in the Upanishads where you meditate on the Devas. The question is, can the Devas meditate on themselves?
Kind of. They are actually meditating on Brahman within themselves:
Sri Bhashya of Ramanujacharya, Vedanta Sutras -
For it is in [the Devas'] case also possible that their attainment of Brahman should be viewed as preceded by their attainment of Vasu-hood or Âditya-hood, in so far, namely, as they meditate on Brahman as abiding within themselves. They may be Vasus and Âdityas in the present age of the world, but at the same time be desirous of holding the same position in future ages also.
Satapatha brAhmaNa is one of the most important brAhmaNas that describe sacrifices. It gives a general principle which answers your question.
And when he offers that offering, he pours out (the ghee) towards that same sap of the sacrifice (in the water) and draws it to him. And, indeed, he pleases those deities to whom he offers that offering, and thus satisfied and pleased, they fit that sap of the sacrifice together for him.
yaddhaivaitAmAhutiM juhoti etamevaitadyajnasya rasamabhiprastRRiNIte tamArunddhe yAbhya u chaivaitAM devatAbhya AhutiM juhoti tA evaitatprINAti tA asmai tRRiptAH prItA etaM yaj~nasya rasaM saMnamanti
When you read the relevant texts recited at a sacrifice from the shuklayajurvedA, you can see the deities whom it is offered to. These are the ones pleased by it. For example, in the text for the agnihotra offerings are made to the Gods in general (verse 1), but also specifically to agnI and sUrya (verse 9), and then indra (verse 46) and rudra (verse 57).
My answer is that the other demigods that the sacrifice is offered to are gratified, so when brahmA performed a sacrifice, this is what probably happened. I see no reason to believe that it is any different when a demigod performs the sacrifice, and brahmA is said to have followed all the vedic instructions exactly. It also seems plausible that a demigod could please himself by a sacrifice.