Units not working properly when using a population mod

Im using a population mod to increase population to 500, the mod seems to run fine until later in the game when civs start maxing out their pop space. It gets to a point where cavalry and some walking units start acting erratic and wont follow commands, it even happens to the ai troops. Lets say i click for them to go north they will start heading south for a second then start bugging out and start pacing back and forth in one spot. It only seems to happen to cavalry, spearman and bowmen. Has anyone ever experienced this? Every game it eventually happens and then all that time wasted. I have a pretty beefy computer, 6800xt 5800x 32gb 3600mhz ram so it cant be my computer. Ive tried multiple different mods as well as making the mod myself. It still happens. Reinstalling game doesnt work. Can the game just not handle that many troops?