Some (many) jockey wheels are fussy about position in the mech and direction of rotation.
Take the rear mech cage apart (again!) and put your best reading glasses on, look for any direction arrows and upper (or guide, top) and lower (or tension, bottom). They often only write on one pulley or side! Then work out which way the pulleys turn when in use...
The lower jockey wheel is designed to take the chain in from a wide range of angles and center it for the upper pulley, the teeth can be shallow and narrow or can be wedge shaped to accommodate the wide range of input angle.
The upper pulley is designed to feed the chain onto the cassette and will have taller straight teeth that will force a gear change, often there is side float on this pulley to allow for near silent operation once changed - this allows for the curved motion of the rear mech not giving a perfect indexing.
Designs and markings vary by manufacturer and model, then there are generic service kits. If you know what to look for you can spot the markings, worse when servicing an old set burried under thick transmission shite.