Let’s say, one just did Netilat yadaim and then makes the bracha and says “Al Mitzvat Tzizit” accidentally, but then corrects himself and says “Al Netilat Yadaim”, does this count as a bracha made in vain? Or is it fine because he corrected himself?
The Shulchan Aruch (OC 209:1) rules:
לקח כוס של שכר או של מים ופתח ואמר ברוך אתה ה' אלהינו מלך העולם על דעת לומ' שהכל וטעה ואמר בפה"ג אין מחזירין אותו מפני שבשעה שהזכי' שם ומלכות שהם עיקר הברכה לא נתכוין אלא לברכה הראוי לאותו המין
You take a cup of beer or water, and started with "Blessed are you Hashem our G-d, King of the Universe", with the intention to say "Shehakol", and accidentally said "Borei Pri HaGafen", you don't have to repeat, since at the time you said Hashem's name and His Kingship, which is the essential part of the blessing, you intended for the correct species.
The Mishnah Berurah (s.k. 1) says this is the opinion of the Rambam, but most (if not all) poskim disagree. Your intention doesn't matter if you ended up saying the wrong blessing.
The Shulchan Aruch continues:
ויש אומרים שאם לקח כוס שכר או מים וסבור שהוא של יין ופתח ברוך אתה ה' אלהינו מלך העולם על דעת לומ' ב"פ הגפן ונזכ' שהוא שכר או מים וסיים שהכל יצא:
There are those that say that if he took a cup of beer or water and thought it was wine, and said Blessed are you Hashem our G-d, King of the Universe, intending to say "Borei Pri HaGafen", and realized it was beer or water and finished "Shehakol", you fulfilled your obligation.
The Mishnah Berurah (s.k. 2) says this is the halacha. This is even though you had the wrong intention when you started the blessing.
Now, the next se'if the Shulchan Aruch discusses your case:
לקח כוס של שכר או מים ובירך ברוך אתה ה' אלהינו מלך העולם בפה"ג ותוך כדי דיבור נזכר שטעה ואומ' שהכל נהיה בדברו וכן היתה אמירתו ברוך אתה ה' אלהינו מלך העולם בפה"ג שהכל נהיה בדברו יצא:
You took a cup of wine or water and said "Blessed are you Hashem our G-d, Kind of the Universe, "Borei Pri HaGafen", and within 2-3 words you realized your mistake and said "Shehakol Nihheh Bidvaro", you have fulfilled your obligation.
The Mishnah Berurah (s.k. 5) says this is true even though your original intent for the blessing was incorrect, and you said the wrong blessing. Since you finished correctly, you have fulfilled your obligation.
However, the Mishnah Berurah (s.k. 6) makes an important caveat. This is only with Rabbinic blessings. However, with Grace after Meals, which is a Torah obligation, you would have to repeat your blessing (see there for another caveat that he makes).
He explains in the Biur Halacha (ד"ה ותוך כדי דיבור) that this is because the gemara has an unresolved question what the halacha should be in this case, and therefore safek berachos lekulah, we are lenient with blessings when there is a doubt. This only applies however to Rabbinic blessings. He clarifies that if you had proper intention, but simply stumbled with what you said and corrected it, you don't have to repeat even a Torah blessing.
Look there where he has a doubt about the second half of the first se'if, maybe the same would be true there (that with a Torah blessing if you had bad intentions but finished correctly, maybe there too you haven't fulfilled your obligation). He leaves it as a doubt what to do in that case.