This idiom comes from a old folk song. the last two stanzas go like this:
One family has five brothers, all serving to a minister as attendants. Every five days, they go back home for a reunion, decorating their horses and garments with shining gold. They vie with each other for ostentation and extravagance, attracting crowds of onlookers along the road.
Now there is a peach tree by a well, and a plum tree next to it. When worms come to gnaw at the root of the peach tree, the plum tree invites them to gnaw at its own root. Finally, the plum dies, ossified.
Even trees know how to sacrifice for other trees, why can’t brothers do the same?