I would like to ask why Allah makes it a point that he saved all the prophets and their followers while still allowing for 11 of the 12 Imams (a.s.) to be martyred. Especially when I read verses like these I get painfully reminded of this fact.

ثُمَّ نُنَجِّي رُسُلَنَا وَٱلَّذِينَ ءَامَنُواْۚ كَذَٰلِكَ حَقًّا عَلَيۡنَا نُنجِ ٱلۡمُؤۡمِنِينَ

(Sahih International)
Then We will save our messengers and those who have believed. Thus, it is an obligation upon Us that We save the believers

-Surah Yunus, Ayah 103

Why did Allah save the prophets (a.s.), but allowed the Imams (a.s.) who are higher in rank than them to be martyred?

The same question applies to Muhammad (s.a.w.)

Many prophets and messengers were killed. See:
Ma’idah 70
Aal Imran 112
An-Nisaa 155

Prophet Yahya’s was beheaded. Prophet Zakariyya was split in half. So many prophets were actually killed.

As for Allah saving his messengers, it means:

1- Their message is saved. The truth does not get lost. Eventually Allah supports the truth and it survives. The message of the Imams has survived throughout the centuries.

2- Allah saves them in critical moments when religion is dependent on their survival. When their enemies try to stop their message and end their religion, Allah saves them. But once they have delivered God’s message, they can be martyred. Martyrdom is the most honorable way to die in the way of Allah.