Even as Russian troops and tanks moved into Ukraine in February 2022, Russian natural gas kept flowing through the country’s pipeline network — set up when Ukraine and Russia were both part of the Soviet Union — to Europe, under a five-year agreement.