Here's what needs to happen:
Draft Bosa. Raiders draft Murray. We swap, for their top of the 2nd round pick.
This solves several problems. We get our guy. Raiders desperately want Bosa. It's the only way they can get him without selling the farm. They get their guy and don't have to give up any 1sts. We keep Bosa out of the hands of the 49ers and the division. We're willing to do that because we got Murray anyway.
Trade Rosen to the Pats for 32.
We get Murray, and 3 picks between 32 and 36.
Raiders get to replace Mack, and keep all first rounders.
49ers get squat.
Rosen gets a real chance, and the team does him a solid after all he went through last year.
Only way it gets messed up is if somebody frantically trades up for Murray (not too likely). Then we just keep Bosa, which was the plan most of the whole time anyway.