I used a custom pivot model as posted here: https://github.com/laravel/framework/issues/2093#issuecomment-39154456
Instead of using the above code in my question, I used a call to newPivot like this:
public function getUnassignedSubjectsCount($projectId)
{
$pivot = Project::newPivot($this, $this->attributes, 'project_subject', true);
return $pivot->where('project_id', 1)->where('assigned', 0)->count();
}
The above returns what is expected.