Addressable build fail due to platform switch

Hi. Our team had have working automated build script until we switched from unity 2021.3.12f1 to 2022.3.22f1 on macbook.
If unity’s current target platform is set to Ios, and I call an editor script that does the following:

EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64);

var settings = AddressableAssetSettingsDefaultObject.Settings;
AddressableAssetSettings.CleanPlayerContent(settings.ActivePlayerDataBuilder);
AddressableAssetSettings.BuildPlayerContent();

I’ve got an error:

InvalidOperationException: Unable to build with the current configuration, please check the Build Settings.
SBP ErrorException
Addressable content build failure (duration : 0:00:00,04)

I tried to move Addressable build call in [UnityEditor.Callbacks.DidReloadScripts] callback with no results.

I have Windows Build Support (mono) installed in the modules list.
If I switch to windows standalone manually, restart the unity and call the script again - it works fine. Also, If I call unity via command line and set -buildTarget win64 arguments it also works fine.

But we don’t want to restart unity N times if we build for N platform, it takes almost twice as long compared to a single unity launch where we switch platforms in code.

9826560–1412721–switch platform agead of build success.txt (79.1 KB)
9826560–1412724–switch platform in code fail.txt (80.1 KB)
9826560–1412730–TestEmptyProj.zip (676 KB)