How can I exclude part of a heading from the outline?

You could work around this by using a lower level heading (like 5th level or however deep your document goes and doing something like this

#outline(depth: 4)

Obviously, you need to create a new header with a level below 4 for this to work, but then you’d have a header that would be bookmarked in the PDF but not visible in the outline