I think the commenter meant that it can produce such an inconsistent result if the identifier names add up to approximately the line length, but the example didn't actually make it so; the identifiers are much shorter than that.
MkDocs has a good plugin system, and it's definitely possible to add a plugin to check each code block according to some rules. I know because I made one :)
https://docs.astral.sh/uv/pip/compile/ • https://docs.astral.sh/uv/reference/cli/#uv-pip-compile