Because Pandoc converts <div class='foo'></div> to \begin{foo}\end{foo} now.
I'm a little surprised that no one has reported it so far. Perhaps this feature is rarely used by anyone... Anyway, this is a nasty bug and needs to be fixed soon.
https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#theorems