The justices overturned a lower-court ruling that questioned whether a complaint system for federal employees is still working as intended after the Republican president fired some of its top officials.