Markdown is not even 10% of the way toward a full document typesetting system, so you might as well throw it away and create a new codebase. The only thing you're really suggesting then is making it backward-compatible with the markdown syntax.
Is markdown anything other than syntax? But yes quite a big part on (mostly) pagination is missing, which will need to be added.
I still think this is easier than merging the commonly used LaTeX packages into one code base and then building a proper IDE and a method to output to HTML.
Much better to start with markdown, extend KaTeX to support whatever you still need for math notation, and then work on making pandoc output to PDF (or equivalent) natively.
On of the bigger problems is bridging the gap between unpaginated HTML and paginated PDF. However if you start from the LaTeX side you'll need to deal with decades of technological debt as well.