Just something for me to reproduce your problem, because what you are saying you are doing doesn’t match the behavior you are describing as far as I can tell.
Thanks, with that information it was trivial to diagnose; you are using Pkg inside of the examples, e.g. here: https://github.com/garrekstemo/TransferMatrix.jl/blob/ead762de5569c09056377e3681f9dfb3d4c09fc6/docs/src/guide/quickstart.md?plain=1#L28 which messes up the environment you have setup beforehand.
Just make these Pkg-blocks raw julia code blocks and configure the packages in docs/Project.toml before instead.