If an application is filed, and proceedings for the formation of the district are commenced and prosecuted, in the manner and within the time specified by this part, the inclusion within the boundaries of the proposed district of any city to which territory is annexed, pursuant to proceedings which were not commenced by the filing of a valid petition prior to the approval of the application, shall not prevent or invalidate the formation of the district even though the territory annexed to the city pursuant to the annexation proceedings is not included in the district.