I suspect you need to edit the “If same reference repeats with…” and move the “|” character to in front of the comma and
In my X9 template, it looks like this-- and thus the , will be there whether or not any of the following fields are needed. I would expect you need to move it to the other side of the comma. Do you ever need the volume number?
Ibid.,| Volume:|p. Cited Pages|.
If not I would try
Ibid.|, Cited Pages|.
with a “link adjacent” in front of “cited pages” field.