Why Noach Built an Ark for Himself
The Ohr HaChaim relates the command “Make yourself an ark” to the verse in Yechezkel naming Noach, Doniel and Iyov, who would save only themselves by their righteousness. Three such people can save themselves, while two or one cannot. So Noach was told to build an ark for himself, because he was not righteous enough to be saved alone, and his sons were not on his level. The Ohr HaChaim adds that Avrohom learned from Noach to ask for ten tzaddikim in Sedom. Once destruction has been released, only people as righteous as Noach can save even themselves. Before it is released, the merit of others could still have saved the world.
Source: Ohr HaChaim, Bereishis, Noach (on Bereishis 6:14)