That's due to
electric-indent-mode, which is a global minor mode.
You could add
(electric-indent-mode -1) to your init file to disable it entirely, or you could try using a custom
The following is only minimally tested, but might do the trick:
(add-hook 'html-mode-hook 'my-html-mode-hook)
(defun my-html-mode-hook ()
"Custom `html-mode' behaviours."
'my-html-mode-electric-indent-maybe nil :local))
(defun my-html-mode-electric-indent-maybe (_char)
"Used in `electric-indent-functions'."
(string= (sgml-tag-name (sgml-parse-tag-backward))