When NuGet updates a package it will uninstall the old package and then install the new one. In order to uninstall the old package it needs information from the package, such as what references were included, so it can uninstall everything from the project. That information is not available from the packages.config file. This is true when using NuGet inside Visual Studio to update a package or when using "nuget.exe update" from the command line.
So you would need to change the order in your list with the restore the packages for B being executed before the packages are updated.