Because a library in a programming language would be madly inconvenient? I can't see something like this being pleasant to use:
document(
paragraph("blah blah blah"),
math("sum_(i=1)^n i = (n (n+1))/2"),
paragraph("foo bar")
)
Also, I'd imagine being a DSL and having a dedicated compiler is what let's Typst have such great incremental compilation (it's actually instant).