How to create & change UniversalRenderPipelineAsset from editor script? Some parameters cannot be changed

I’d like to create UniversalRenderPipelineAsset and UniversalRendererData files from editor script.

The purpose is in order to “automate” the initial project settings about URP.

I have been able to create these asset files with writing following script, but I could NOT change several parameters from script (see below comments in code) because these parameters are defined as “get” only.

Is there any way (or workaround) to achieve it?

[MenuItem("!!!! Test Menu !!!!/Create URP Assets")]
public static void SetupURPAssets()
{
    var urpAssetRender = ScriptableObject.CreateInstance<UniversalRendererData>();
    urpAssetRender.shadowTransparentReceive = false;
    urpAssetRender.intermediateTextureMode = IntermediateTextureMode.Auto;
    AssetDatabase.DeleteAsset("Assets/zzz_urp_render.asset");
    AssetDatabase.CreateAsset(urpAssetRender, "Assets/zzz_urp_render.asset");
    EditorUtility.SetDirty(urpAssetRender);
    AssetDatabase.SaveAssets();
    AssetDatabase.Refresh();

    var urpAsset = UniversalRenderPipelineAsset.Create(urpAssetRender);
    //urpAsset.supportsTerrainHoles = false;          // Cannot change because 'get' only !!!!
    urpAsset.supportsHDR = false;
    //urpAsset.enableLODCrossFade = false;            // Cannot change because 'get' only !!!!
    //urpAsset.mainLightRenderingMode = false;        // Cannot change because 'get' only !!!!
    //urpAsset.additionalLightsRenderingMode = false; // Cannot change because 'get' only !!!!
    AssetDatabase.DeleteAsset("Assets/zzz_urp.asset");
    AssetDatabase.CreateAsset(urpAsset, "Assets/zzz_urp.asset");
    EditorUtility.SetDirty(urpAsset);
    AssetDatabase.SaveAssets();
    AssetDatabase.Refresh();
}

I just came up with a workaround using SerializedObject.
I could achieve what I want, with following script.

However, I think this workground seems “dangerous” because it means forcing the rewriting of “private” members of ScriptableObject.
So I want to avoid this workaround if possible.

Is there “safer” way to rewrite these parameters from C# script (rather than from the Inspector GUI)?

[MenuItem("!!!! Test Menu !!!!/Create URP Assets")]
public static void SetupURPAssets()
{
    var urpAssetRender = ScriptableObject.CreateInstance<UniversalRendererData>();
    urpAssetRender.shadowTransparentReceive = false;
    urpAssetRender.intermediateTextureMode = IntermediateTextureMode.Auto;
    AssetDatabase.DeleteAsset("Assets/zzz_urp_render.asset");
    AssetDatabase.CreateAsset(urpAssetRender, "Assets/zzz_urp_render.asset");
    EditorUtility.SetDirty(urpAssetRender);
    AssetDatabase.SaveAssets();
    AssetDatabase.Refresh();

    var urpAsset = UniversalRenderPipelineAsset.Create(urpAssetRender);
    urpAsset.supportsHDR = false;
    var urpAssetSO = new SerializedObject(urpAsset);
    urpAssetSO.FindProperty("m_SupportsTerrainHoles").boolValue = false;
    urpAssetSO.FindProperty("m_EnableLODCrossFade").boolValue = false;
    urpAssetSO.FindProperty("m_MainLightRenderingMode").enumValueIndex = (int)LightRenderingMode.Disabled;
    urpAssetSO.FindProperty("m_AdditionalLightsRenderingMode").enumValueIndex = (int)LightRenderingMode.Disabled;
    urpAssetSO.ApplyModifiedProperties();
    AssetDatabase.DeleteAsset("Assets/zzz_urp.asset");
    AssetDatabase.CreateAsset(urpAsset, "Assets/zzz_urp.asset");
    EditorUtility.SetDirty(urpAsset);
    AssetDatabase.SaveAssets();
    AssetDatabase.Refresh();

    GraphicsSettings.defaultRenderPipeline = urpAsset;
    QualitySettings.renderPipeline = urpAsset;
}

I just checked SerializedObject API document to investigate this issue.

This document says:

One of the most common uses of the SerializedObject and SerializedProperty classes is when creating custom Editors, where using SerializedObject is the recommended approach as opposed to modifying inspected target objects directly.

Does this mean it is no problem to rewrite private [SerializedField] members via SerializedObject API as in the custom Editor script I posted on #2?

Rather, I interpreted it as the Unity official recommended method for custom Editor scripts.

If anyone is familiar with the purpose of SerializedObject API, I would appreciate your perspective.