How do I set header only after the first page of the chapter?

Hello, welsome to the forum! Make sure to read the guide How to post in the Questions category
and to edit your post approprately, namely keeping in mind

and

Currently, your code sample does not compile.

Also, if I may propose a small re-write, I suggest that the way you display the chapter title be changed to a heading. This allows for more introspection, and has the added benefit of chapters showing up as bookmarked, allowing PDF readers to show them in a menu:

On to the question: with the re-write, you could set the header to query for the chapter and style it depending on the answer:

#let chapter(
title: none,
epigraph: none,
branding-colour: purple,  // change as needed
body
) = {
  set page(header: context {
    let heading-query = query(
      selector(heading).after(here())
    )
    let has-heading = if heading-query.len() >= 1 {
      heading-query.first().location().page()  == here().page()
    } else {
      false
    }
    if not has-heading {
      [#title #h(1fr) #here().page()]
    }
  })
  
  set heading(numbering: (..nums) => {
    "Chapter " + numbering("1.1", ..nums)
  }, supplement: "Chapter")
  show heading.where(level: 1): set align(right)
  
  // title
  heading(level: 1, text(fill: branding-colour, size: 24pt)[#title])
  
  // Now the main content of the chapter
  body
}

Note that I removed/changed some irrelevant parts in the sample