Hi there.
This is way to broad of a question to be honest. Without seeing you play and without seeing the struggle it's almost impossible to experiment with ideas and pinpoint.
The Thumb under technique itself is questionable, when you say miss the note do you not reach it do you go to far?
I can only assume you're doing it too fast, have not practiced the correct motion and have unfortunately set in your muscle memory the "wrong notes" or not properly identified the area of the note in which your thumb needs to be to be accurate. It is very difficult to undo without time and patience.
Scenario for you (There could be many examples)
Imagine throwing a dart at a board, now it doesn't matter where you hit the board as long as you hit the board. You'll practice making sure you hit the board and nothing else (walls or windows!)
It's quite a big target so say you miss 1 in 10 times but eventually you get really good and hit the board every single time, occasionally the bullseye (middle), but mostly all around the board the top, bottom etc
Then somebody tells you that you actually are only able to hit bullseye and not the rest of the board. Suddenly rather than missing 1 in 10 times you miss 9 in 10 times because you haven't practiced hitting that precise spot you've just practiced all around and randomly hitting it.
The point here, is you're only as accurate as your practicing allows you to be. Your brain doesn't think about the width of every key and every distance as you play, it instinctively remembers based on what you tell it, and what you tell it has to be accurate.
I don't know about your technique, there could be nothing wrong, there could be many things wrong (thumb under too far, wrists twisted or too high, arms flare out, raised shoulders etc etc) But assuming you feel no pain in what you're doing, go back to basics, use a metronome if you have one and practice very slowly, don't practice runs up the keyboard, because the rest seems to be fine and would be pointless to practice what is right already (based from your question) only practice this thumb under so in C major scale i'd start RH on 3-E and go straight into that thumb under to make sure i'm hitting F, slowly and accurately then 2-3-4, thumb under accurately hit C and then come off and start again, once you've got the F and C accurate, up the tempo a little, slowly start to introduce 2 octaves and ensure accuracy as the highest priority.
Use the same approach to other scales, you will find similarities in some but there is never a need to rush.
Apologies I don't have the reference here, but I have read that it takes 5x the amount of practice to properly undo an incorrect practice so spend 20 hours hitting sometimes the wrong key and you'll be spending 100 hours to make sure you get it right from now on. that's not just applicable with wrong notes, but wrong sounds, wrong fingers, wrong posture wrong everything, really take a conscious and practical approach to your practice sessions with sensible goals in mind to really see correct progress.
Hope that helps.