So I just learned this piece (I am working on the Fugue now) and I had a similar issue for a while. My teacher helped me by making me do 2 things. Play is very slowly to ensure the 2 hands are together and use a metronome. She made sure that I did not increase the speed until I could do it perfectly at the starting bpm. If she noticed that things were getting a little sloppy, we reduced the speed. Since this is one of the few pieces by Bach with a suggested timing for one section (prestissimo at the end), I checked and many people play this at varying rates (https://bachwelltemperedclavier.org/pf-c-minor.html). The important thing is to have enough of a difference in tempo between the beginning and the prestissimo section. If you start too fast, there is no where to go to create the difference in tempo.