Page from template order of operations?

I’ve got two potentially related issues on my daily journal template.
My frontmatter for the template includes date related functions as follows:

frontmatter:
  date: "{{dateFromJournal(@page.name)}}"
  previousday: "{{formatDate(addToDate(dateFromJournal(@page.name),0,0,0,-1),'YYYY/MM/DD')}}"
  year: "{{formatDate(dateFromJournal(@page.name), 'YYYY')}}"

and then I have a template section at the top of the page:

<< [[Journal/Day/{{escapeDirective("@page.previousday")}}|Yesterday]] ||[[Journal/Year/{{escapeDirective("@page.year")}}|{{escapeDirective("@page.year")}}]] [[Journal/Month/{{escapeDirective("@page.year")}}/{{escapeDirective("@page.month")}}|{{ escapeDirective("@page.month")}}]] [[Journal/Week/{{escapeDirective("@page.weekYear")}}/{{escapeDirective("@page.week")}}|W{{escapeDirective("@page.week")}}]] || [[Journal/Day/{{escapeDirective("@page.nextday")}}|Tomorrow]] >>

# {{escapeDirective("formatDate(@page.date,'dddd, MMMM D, Y')")}}

On a new page using the template I get this box at the top:
image
But then navigating into it and back out gives me the result I’m actually looking for:
image
And I usually just bake it at that point, since it won’t need to change from then on.

I’m now trying to add a conditional section to the page:

{{#if escapeDirective("formatDate(@page.date,'dddd')") = "Sunday"}}
## Sermon Notes
- **Pastor:** 
- **Sermon Topic:** 
- **Key Scripture(s):** 
- **Insights/Reflections:**
  - What stood out to me today?
  - How can I apply this in my life?
{{else}}
## Bible Study Notes
- **Bible Study Topic:** 
- **Key Scripture(s):** 
- **Insights/Reflections:**
  - What stood out to me today?
  - How can I apply this in my life?
{{/if}}

With the idea that if it’s Sunday, I’ll have one set of notes, and if not I’ll have the other. But no matter how I’ve tried with it so far (with/without the escapeDirective, in or out of a template block), it won’t render the “Sunday” Block, just the else.

I’m guessing that it has something to do with the fact that the @page.date item doesn’t exist on first load of the page and that that’s when the if block is being checked? I’m sure I could dig through the code to figure this out, but would it be possible to get a list of the “order of operations” so to speak for a new page being created from a template?

Actually, in doing some further testing, if I replace all the @page.attr with it’s respective function from the front matter, it doesn’t give me the invalid ISO error anymore. So I guess at the point the templates are rendered, the @page.name exists, but none of the other attributes.

I also still need to have it in a template block for it to load correctly, and it doesn’t fix the if section, so not quite a solution, but at least it makes it a little less work on a new page.