Gerrans did one thing smart, mark Nibali most if not all the way up the poggio. When Nibali gets out of the saddle to attack I don't think a single inch opens.
After that only an idiot would have done anything differently.
As for Cancellara, he had a few other options, but really ran out of them. The big thing he could have done differently would be launch the attack on the poggio, tough ask without a teammate, so he waited for Nibali's. Couldn't get to the top fast enough to drop Nibali or Gerrans, pushed them both on the decent frequently opening up gaps on the decents, but it's tough to drop someone on a decent unless they are a muppet. Once they came off the decent, there aren't any sharp coners to take a risk on. So what do you do, with Sagan, Friere, Degenkolb approaching after riding in wheels? He has 2 options, sit up and go into the bunch and chance it in a sprint or a attack at 1 or 2 to go, or push hard to the finish and hope Gerrans is shattered after trying to hold his wheel.
Maybe he should have backed himself to launch an attack earlier on the poggio, bet he wished he rode for...well someone with a classics team, though bennati is doing ok.