To which markdown flavour are you rendering to ? Which output format function are you using ?
I think it is expected that a # is escaped in Markdown if it does not indicate formating.
So if you write
---
title: "test"
output: md_document
---
This will include the hash as is #tags
\#tag as first
it will be rendered as this with # escaped are none of them indicated formatting.
This will include the hash as is \#tags
\#tag as first
This is how Pandoc is working.
$ pandoc -t markdown_strict <<< "this is a #tag"
this is a \#tag
$ pandoc -t commonmark <<< "this is a #tag"
this is a \#tag
For the first # the backslash is not necessary but unharmful as \# means a literal # but still added by Pandoc. See