Before chemical leavening agents such as baking soda and baking powder, there was (and still is) fermentation, typically with yeast. It affects the entirety of the dough as it converts sugar into carbon dioxide and alcohol, causing it to expand and rise and even brings out flavor and acidity, like in sour dough bread. This is an irreversible process.
The leaven of the Pharisees is hypocrisy, religiousness, exclusivity, traditions, rules, laws, etc.
The leaven of Herod (Roman law) is honoring the civil law, man-made law, above God's.
Both of these are 2 sides of the same coin, the same leaven, leading to a swelling of pride and self.
Now they had forgotten to bring bread, and they had only one loaf with them in the boat. And he cautioned them, saying, “Watch out; beware of the leaven of the Pharisees and the leaven of Herod.” And they began discussing with one another the fact that they had no bread. And Jesus, aware of this, said to them, “Why are you discussing the fact that you have no bread? Do you not yet perceive or understand? Are your hearts hardened? Having eyes do you not see, and having ears do you not hear? And do you not remember? When I broke the five loaves for the five thousand, how many baskets full of broken pieces did you take up?” They said to him, “Twelve.” “And the seven for the four thousand, how many baskets full of broken pieces did you take up?” And they said to him, “Seven.” And he said to them, “Do you not yet understand?”
Mark 8:14-21 ESV
5 loaves of bread for 5000 people
12 baskets leftover
7 loaves of bread for 4000 people
7 baskets leftover
After all this time with him, his disciples can't see that he can use little to nothing for far more than we can imagine, as Jesus created more food for more people with less source material (5 loaves vs 7 loaves) but had substantially more leftover (12 baskets vs 7 baskets).
In contrast to the leaven of the Pharisees and Herod is the kingdom of God. Jesus continually demonstrates the surplus of his power, miraculous abundance of his faith in action and how you can't hide him, what he's done or doing, as he causes all he touches to rise and grow beyond what was possible without him.
He told them another parable. “The kingdom of heaven is like leaven that a woman took and hid in three measures of flour, till it was all leavened.”
Matthew 13:33 ESV
And again he said, “To what shall I compare the kingdom of God? It is like leaven that a woman took and hid in three measures of flour, until it was all leavened.”
Luke 13:20-21 ESV
Jesus [said], "The Father's kingdom is like [a] woman. She took a little leaven, [hid] it in dough, and made it into large loaves of bread. Anyone here with two ears had better listen!"
The Gnostic Gospel of Thomas 96.
Then Peter came up and said to him, “Lord, how often will my brother sin against me, and I forgive him? As many as seven times?” Jesus said to him, “I do not say to you seven times, but seventy-seven times. “Therefore the kingdom of heaven may be compared to a king who wished to settle accounts with his servants. When he began to settle, one was brought to him who owed him ten thousand talents. And since he could not pay, his master ordered him to be sold, with his wife and children and all that he had, and payment to be made. So the servantfell on his knees, imploring him, ‘Have patience with me, and I will pay you everything.’ And out of pity for him, the master of that servant released him and forgave him the debt. But when that same servant went out, he found one of his fellow servants who owed him a hundred denarii, and seizing him, he began to choke him, saying, ‘Pay what you owe.’ So his fellow servant fell down and pleaded with him, ‘Have patience with me, and I will pay you.’ He refused and went and put him in prison until he should pay the debt. When his fellow servants saw what had taken place, they were greatly distressed, and they went and reported to their master all that had taken place. Then his master summoned him and said to him, ‘You wicked servant! I forgave you all that debt because you pleaded with me. And should not you have had mercy on your fellow servant, as I had mercy on you?’ And in anger his master delivered him to the jailers, until he should pay all his debt. So also my heavenly Father will do to every one of you, if you do not forgive your brother from your heart.”
Matthew 18:21-35 ESV