The Nuget package makes edits to the csproj to comment out these unneeded portions of the csproj since we actually want to target the compact framework targets files:
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
...
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
To gets this edit to take effect through MSBuild, it needs to be done as part of a pre-build step, however by that time MSBuild will have loaded the .csproj to memory, which is why the second compile with the freshly edited .csproj works fine.
Currently this task is running with BeforeTargets="BeforeBuild;BeforeClean", but if there is a different target that occurs when the package is restored that would be even better.