I have many bad habits due to being forced to prematurely output for many years in school. How should I go about fixing these bad habits?
In an ideal situation you want to avoid premature output because the bad habits you form are very hard to get rid of later. Once a bad pronunciation habit is formed, it doesn't go away. It becomes like a crease in paper. So you want to speak correctly the first time. In order to achieve that you avoid early output until the time when you would intuitively know the right way to say something.
If you already have bad habits, you have to amass lots of input first. Go through a silent period. A silent period is when you don't output and listen a lot. Listen to your target language all the time for about a year to ingrain the sounds of the language into your brain. You need to build an intuitive understanding of the sounds separate from your muscle memory.
From my experience and experience of other learners, if you have bad habits, immersion alone won't fix all of them. Even after thousands of hours of immersing in the language your pronunciations won't recover completely. After the silent period many of the bad habits may still be present. You are going to fix your listening ability and perception of phonemes, but you still have to address your muscle memory which has formed due to early output.
We can see this in real life when we look at other people. They move to a country they have never been to before and don't speak the language. They learn the language eventually, but because they were forced to output from the start, their pronunciation fossilizes in a way. They retain foreign accents despite seemingly continuing to immerse all the time. And they are repeating the same mistakes over and over, essentially practicing their bad habits instead of trying to correct them.
To correct the remaining bad habits, study tongue placement and imitate native speakers. When imitating native speakers, pay extra attention to the sounds in each word and record yourself to see where you're off. So for example you would try to repeat sentences in an audiobook word for word while recording yourself. When you listen to the recording, you get feedback and can figure out what your most glaring bad habits are. Then you could work on each pronunciation mistake one at a time. Focus on mistakes that sound the most foreign.
Practice saying each piece correctly over and over until you get it right.
Eventually it becomes automatic.
You could also cut a short clip where a native speaker says it and listen to it on repeat.
To find example pronunciations you could use
Captionpop, or your local sentence bank in Anki.
To record audio on the spot there's a script called dmenurecord.
English learners should always check the IPA notations of the words they are learning to pronounce. For Japanese learners knowing IPA isn't necessary, but they need to pay attention to the pitch accent.