Poland regained its independence in 1918 only to be overrun by Germany and the Soviet Union in World War II .