Binary that generates doc comments - circular build dependencies

I have a binary in src/bin that generates documentation that I thought I could somehow include in for example
The problem with this is that said binary depends on a module from the project.
The reason is that said binary serializes some structs defined in the project (and displays these json-serialized structs) in the generated doc comments.
So.. to generate the doc comments needed in, first, the crate has to be built, so I have a sort of circular dependency.

Is it possible to solve this by somehow doing two passes (without increasing compilation time noticeably)?
Or am I forced to move the relevant structs out to a new crate?

I guess for now I can create a separate crate for generating the documentation. Downside: can't include the generated docs in the main crate. Doesn't matter much. But open for suggestions.

Can the build script can generate it and output the path of the file to include? I'm sure it has been done in some crate before, there should be examples out there.