Sounds like you have a working option , but for completeness I did make a Pandoc filter for indexes that is an alternative workflow:
This steps the filter entry one step back, the markdown still contains the \index{keyword} and the filter adds the correct low-level markup when generating the output. This makes the Scrivener compile format more generic and the markdown document more compatible, you can use the same compiled markdown for ODT/DOCX/Typst/LaTeX.