Your interpretation is based on wrong assumptions. It does not matter at which time they left the Union.
Among other official documents, there is the Declaration of the Twelve, where 12 European countries, including Germany, recognised that Russia is the successor state to the USSR and therefore all treaties with the USSR continue forth with Russia. Otherwise they would have had to start from scratch with every treaty with Russia.
Every treaty between Germany and the USSR is still legally binding.
