(Exodus 32:32) "And now, if You will forgive their sin..." Rabbi Natan says: Jonah went only to destroy himself in the sea, as it is said, "Lift me up and cast me into the sea" (Jonah 1:12). And likewise you find concerning the patriarchs and the prophets, that they gave their lives for Israel. Concerning Moses it says, "And now, if You will forgive their sin" [and if not, blot me out], and "if this is how You deal with me" (Numbers 11:15). Concerning David it says, "And David said to the LORD, Behold, I have sinned, and these sheep, what have they done?" (II Samuel 24:17).
The Shepherds Who Offered Their Own Lives for Israel
Yalkut Shimoni on Torah 393:3
(שמות לב לב) וְעַתָּה אִם תִּשָּׂא חַטָּאתָם. רַבִּי נָתָן אוֹמֵר. לֹא הָלַךְ יוֹנָה אֶלָּא לְאַבֵּד עַצְמוֹ בַּיָּם, שֶׁנֶּאֱמַר "שָׂאוּנִי וַהֲטִילֻנִי אֶל הַיָּם". וְכֵן אַתָּה מוֹצֵא בָּאָבוֹת וּבַנְּבִיאִים, שֶׁנָּתְנוּ נַפְשָׁם עַל יִשְׂרָאֵל. בְּמֹשֶׁה הוּא אוֹמֵר, וְעַתָּה אִם תִּשָּׂא חַטָּאתָם (במדבר יא, טו) "וְאִם כָּכָה אַתְּ עֹשֶׂה לִי". בְּדָוִד הוּא אוֹמֵר, (שמואל ב כד, יז) "וַיֹּאמֶר דָּוִד אֶל ה' הִנֵּה אָנֹכִי חָטָאתִי וְאֵלֶּה הַצֹּאן מֶה עָשׂוּ" וְגוֹ'.