Why does Actor::AttachToComponent not work and result in Template Mismatch during attachment?

Inside ATheThirdPersonGameCharacter ::BeginPlay()

  • IsTemplate()` returns false: instanced

Inside UInventoryComponent::AttachToCharacter(...):

  • UInventoryComponent::IsTemplate() returns false: instanced
  • ATheThirdPersonGameCharacter ::IsTemplate() returns true: template
  • The Character’s USkeletalMeshComponent::IsTemplate() returns true: template
  • APickup::IsTemplate() returns false: instanced
  • The Actor’s UStaticMeshComponent::IsTemplate() returns false: instanced

UObjectBaseUtility.h

/**
* Determines whether this object is a template object
*
* @return	true if this object is a template object (owned by a UClass)
*/
bool IsTemplate( EObjectFlags TemplateTypes = RF_ArchetypeObject|RF_ClassDefaultObject ) const;

The reference to ATheThirdPersonGameCharacter is a template object. It is the Class Default Object (CDO) that you get from (see https://1danielcoelho.github.io/unreal-engine-basics-base-classes):

  UClass* Class = Object->GetClass();
  UMyObject* CDO = Class->GetDefaultObject<UMyObject>();

But why does the following reference a CDO and not the instanced object?

class ..._API UInventoryComponent : public UActorComponent
{
private:
	UPROPERTY(Transient, DuplicateTransient)
	TObjectPtr<ATheThirdPersonGameCharacter> CharacterOwner;
}
void UInventoryComponent::PostLoad()
{
	Super::PostLoad();
	CharacterOwner = Cast<ATheThirdPersonGameCharacter>(GetOwner());
}

I initialized the CharacterOwner in PostLoad(), because it is done in a similar way in UCharacterMovementComponent::PostLoad().