Crash in DuplicateObject<USkeletalMesh>() when data is Cooked

We are loading the template skeletal mesh, applying some complex changes to its geometry with:

RHICmdList.LockBuffer() and RHICmdList.UnlockBuffer()

in the render thread, then repeating the process for the next instance. This is how we prepare them for rendering so that they all look unique.

The problem is, when the geometry is not duplicated, all the instances end up using the same geometry and they all end up looking the same.

Here is the callstack:

duplication_test-Win64-DebugGame.exe!UE::Logging::Private::BasicFatalLog(struct FLogCategoryBase const &,struct UE::Logging::Private::FStaticBasicLogRecord const *,...)
duplication_test-Win64-DebugGame.exe!FDuplicateDataReader::Serialize(void *,__int64)
duplication_test-Win64-DebugGame.exe!Nanite::FResources::SerializeInternal(class FArchive &,class UObject *,bool)
duplication_test-Win64-DebugGame.exe!Nanite::FResources::Serialize(class FArchive &,class UObject *,bool)
duplication_test-Win64-DebugGame.exe!FSkeletalMeshRenderData::Serialize(class FArchive &,class USkinnedAsset *)
duplication_test-Win64-DebugGame.exe!USkeletalMesh::Serialize(class FArchive &)
duplication_test-Win64-DebugGame.exe!StaticDuplicateObjectEx(struct FObjectDuplicationParameters &)
duplication_test-Win64-DebugGame.exe!StaticDuplicateObject(class UObject const *,class UObject *,class FName,enum EObjectFlags,class UClass *,enum EDuplicateMode::Type,enum EInternalObjectFlags)
duplication_test-Win64-DebugGame.exe!DuplicateObject_Internal(class UClass *,class UObject const *,class UObject *,class FName)
duplication_test-Win64-DebugGame.exe!DuplicateObject<USkeletalMesh>(const TObjectPtr<USkeletalMesh> & SourceObject, UObject * Outer, const FName Name) Line 1864
	at C:\Program Files\Epic Games\UE_5.5\Engine\Source\Runtime\CoreUObject\Public\UObject\UObjectGlobals.h(1864)
duplication_test-Win64-DebugGame.exe!UDDEditableSkeletalMeshComponent::BeginPlay() Line 19
	at C:\Projects\duplication_test_5_5\Source\duplication_test\DDEditableSkeletalMeshComponent.cpp(19)
[External Code]
duplication_test-Win64-DebugGame.exe!Aduplication_testCharacter::BeginPlay() Line 99
	at C:\Projects\duplication_test_5_5\Source\duplication_test\duplication_testCharacter.cpp(99)
[External Code]