This idea is borrowed from the multires modifier, which already checked if the object was in sculpt mode and, if so, created the PBVH. That check is now moved higher up the chain into mesh_build_data(), so that it occurs for CDDerivedMesh too. This also replaces an assert in cdDM_getPBVH for tesselated mesh faces with a call to create them if missing.