This doesn't makes sense at all. In order to set the automation you need the phone unlocked, so it does already ask for a pin to unlock the phone , an no further requirement fr this should be asked. There is workaround only if the phone is connected with USB directly to the server. Testing over the wifi is much more user like experience.
@Apple , you need to fix this. What is the behavior in iOS16 is it same?