It speaks to 2 kinds of sorrow. One comes from God and leads to repentance unto salvation. The other is a worldly sorrow produced by man and leads to death.
God giving you sorrow is no different to God saying to cain, who was looking all gloomy, because his offering had not been accepted.
God Said to Cain if you do what is right you will be accepted.
That was God giving Cain sorrow even tho he knew he was about to strike cain, he was giving him sorrow in advance, he still had to do what was right afterwards, but he never and he struck able .
He gave him more sorrow sorrow by punishing him, God could have struck him dead.
He gave Adam and eve sorrow by clothing them, and punishing them, but they still had to serve their punishment and do what was right.