Currently CSSOM says:
If it is an ASCII case-insensitive match for a pseudo-element that the UA supports, other than ::slotted(), let obj be the given pseudo-element of elt.
This isn't a well-founded operation; there's no way to match a string against a pseudo-element. You need to do a [=CSS/parse=] of the string (clarifying that CSS syntax in general is supported; otherwise you have to define bespoke parsing) as a <<pseudo-element-selector>>, and then have it represent the corresponding pseudo-element that would match that selector on the element.
See https://drafts.csswg.org/css-pseudo-4/#window-interface for an example of similar text.