Sure, a 4th rounder for a guy with that much upside is a steal. Even if you keep him as a backup. If dak gets hurt and he plays a few games and does well you can probably flip him for a 3rd.
Discussion
I think Lance can thrive under the right system. He wants to throw down field or run. 49ers want their QBs to get the ball out quick to first read of check it down to the RBs and let the playmakers make the plays.