A speech by the Russian president set out a series of military advances and warnings to the West three weeks before the country’s presidential elections.