That's how treaties work. Whoever is in charge of the country at the time signs them. Yeltsin signed the Russian–Ukrainian Friendship Treaty, which Putin then broke in 2014.
https://www.chicagotribune.com/news/ct-russia-recognizes-ukrainian-independence-1991-20220224-uptvhapy7rh23lr73a4xreiime-story.html