OnPostProcessBuild bug?

Hi there. I have just discovered something about the OnPostProcessBuild method that I thought worked one way the longest time but have now realized has changed for some time now. So let me explain. For my current multi-platform project, I have a build script for making Steam builds that first removes the “DISABLESTEAMWORKS” symbol(which disables steam from running on non-Steam builds) from the preprocessor definitions list in the OnPreprocessBuild method, then when the build is completed, it readds the definition into the list in the OnPostProcessBuild method. I know for a fact this USED to work. However quite awhile back, weird things started happening, such as certain steam features no longer working properly. Today I realized after some debugging that the OnPostProcessBuild method no longer runs AFTER the build is officially completed, but rather at some point before it, which means that it inserts the DISABLESTEAMWORKS symbol back into the build prior to completion! Below is the code snippet of the functions in question:

public void OnPreprocessBuild(BuildTarget target, string path)
        {
            // Enable steam bundle if MacOS and isSteamBuild
            SetMacOSLibState(TeamCityBuildScript.isSteamBuild && target == BuildTarget.StandaloneOSX);
        
            // Set asset states to be correct
            if (TeamCityBuildScript.isSteamBuild)
            {
                SetPurchasingState(false);
                BuildHelper.DisableUnityPurchasing(target);
                BuildHelper.EnableSteamSDK(target);
                PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, ScriptingImplementation.IL2CPP);
                //PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, ScriptingImplementation.Mono2x);
                SetSplash();
            }
            else
            {
                SetPurchasingState(true);
                BuildHelper.EnableUnityPurchasing(target);
                BuildHelper.DisableSteamSDK(target);
            }
        }

        public void OnPostprocessBuild(BuildTarget target, string path)
        {
            if (TeamCityBuildScript.isSteamBuild)
            {
                SetPurchasingState(true);
                BuildHelper.DisableSteamSDK(target);
                PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, ScriptingImplementation.IL2CPP);
                //PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, ScriptingImplementation.IL2CPP);
                RevertSplash();
                BuildHelper.GenerateConfiguration(false,false);
            }
        }

public static void DisableSteamSDK(BuildTarget target)
{
    var group = BuildPipeline.GetBuildTargetGroup(target);
    string definedSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
    definedSymbols = GetSteamDisabledSymbols(target, definedSymbols);
    ApplyNewDefinitionSymbols(group, definedSymbols);
}

Now I don’t know when exactly this changed or if its intentional. If it is intentional, can you let me know what the correct method is to use in order to achieve the same result? At the moment I’ll probably have to implement some workaround to fix this issue, but it would be good to know what the best practice for this is.

EDIT: I’ve also just realized that these methods are currently obsolete and should instead use the ones from here instead:

Going to switch over to that to see if it fixes the problem.

Ok seems like switching over to the new method fixed the issue. Just kinda annoyed the obsolete one was broken without warning. Might want to mention that in documentation if it was intentional.