Refs #8913 Move history creation to be conditional.

We should only create a history record if we're tracking it as we only discard it later.
Merge branch 'feature/8913_nested_algorithm_history' into develop