The redemption from Egypt was driven by a higher purpose than the merit of the people being saved. At the time of the Exodus, the Israelites were actually unworthy of rescue and faced potential destruction. However, God chose to spare them and lead them into the desert. There, He would give them His laws and perform miracles, acting primarily to protect His own honor and prevent His name from being disgraced in the world [מלבי״ם].
The primary approach among commentators is that the risk of disgrace stemmed from God's public promises. God had openly revealed Himself to the Israelites and assured them of their coming freedom. The Egyptians were fully aware of these promises, which had been communicated to the Israelites either through Aaron [מצודת דוד] or through various prophets who spoke to the people even before Moses arrived [רד״ק].
Because the Egyptians recognized the Israelites as God's chosen people and knew about the promised redemption, wiping out the Israelites within Egypt would have led to a disastrous misunderstanding. The Egyptians would have concluded that God destroyed His own nation simply because He lacked the power to defeat Egypt and bring them to freedom [רש״י, מצודת דוד]. To prevent this false narrative, God acted for the sake of His name, ensuring He would not be diminished in the eyes of the Egyptians.
This creates a dilemma regarding the wicked among the Israelites who refused to repent even after Moses appeared. They deserved punishment, but if the Egyptians saw them fall, they would rejoice, causing the exact disgrace God sought to avoid. To resolve this, God brought death upon these unrepentant individuals during the three days of the plague of darkness. By doing so under the cover of total darkness, their punishment remained completely hidden from the Egyptians [רד״ק].