I've figured out what's going on with the pie demon, and it's a bit obscure, I'm afraid...
Discovering a demon name, with no goals active, will stop auto-adventuring. This, and other things that stop adventuring, are handled internally as a "pending state", which is basically the same as an error state except that it doesn't turn the display red. You normally never see a pending state in ASH, since they generally occur in the context of auto-adventuring, which will clear the pending state before returning. The pending states that occur when demons 2-5 are discovered therefore cause no problem.
However, when a demon name is discovered in the Summoning Chamber, there is no adventure request in progress - the pending state is still active on return from the cli_execute("summon..."). Like any error state, this is capable of aborting your script, and since you didn't capture the return value of cli_execute(), it does - the function immediately exits, without executing the final return get_property("demonName1") != "";
However, the return value of find_pie_demon() is used in your script, so THAT captures the error state, and allows the script to continue. Note that the 'return' statement didn't actually execute, so the apparent value of find_pie_demon() is unspecified - it happens to always be 'false' in this case (thus causing the script to believe that the name wasn't found), but in general the result of capturing the return value of an aborted user-defined function (rather than the built-in function that actually caused the abort) is meaningless.
What you need to do is capture the error at the source - the cli_execute(). Any of the following will do the job:
boolean _ = cli_execute(...);
if (cli_execute(...)) {}
(!cli_execute(...));