The factorGraph series of functions was introduced in the recent R2022a release. Many of the descriptions of this series of functions are not stable and reliable, and addFactor returns factorID, which is based on a 0-base index, making it counter-intuitive.
Personally, to avoid unexpected results, I recommend using the poseGraph family of functions to solve your problem until Mathworks has officially updated the factorGraph description. As of now the affected versions are R2022a,R2022b.
references Issues: