Ukraine agreed to that as an accommodation to European economic interests and their need for natural gas.
Judging from the German criminal investigation, they deem that their economic interests and need for natural gas were violated. Maybe the real reason for the Nordstream attack is that unlike the pipelines in Ukraine, there was no economic impact for Ukraine.