I think even making a plugin based on one of the existing Kroki Rust crates is not an option: as I understand these crates communicate with a Kroki instance, and plugins cannot do that (whether the instance is local or remote doesn’t matter). You would need to build the whole Kroki server in WebAssembly as a Typst plugin and that seems prohibitively difficult.
If you want to go with the preprocessing workflow, have a look at the prequery package, which was made for this kind of tasks.
However I think the best solution by far is to embrace the Typst model: do not try to use a network API during compilation. Use the existing diagram-drawing packages, maybe write your own wrapper package to support many formats with a unified API, and make new packages/plugins yourself when you find that you need something that’s not already available in the Typst Universe.
By the way there’s already a lot of diagramming packages in the Universe! Maybe the first step should be to research which tools are already supported as packages/plugins and which are missing. For example, there are already packages that support the syntax of wavedrom, graphviz and mermaid…