The question on ERAS where this may need to be disclosed is the one asking if there are any issues that might impact your ability to get licensed. Unfortunately, some states see mental illness as a barrier to licensure -- although this is usually a bigger problem when you try to get a permanent license rather than a training license, since the board knows you'll be supervised closely.
So how should you have answered this question? That's complicated. It would depend on what you mean by "erratic behavior" -- if that behavior could put patients in danger, then the right answer is probably yes, and otherwise I think it's OK to answer no. However, the "safest" answer is to pick "yes", and then add an explanation -- that way, you can't be blamed for lack of disclosure.
So what should you do? Completely withdrawing from the match seems like an over-reaction. If you disclose to all programs now, you can explain that you initially answered the question "no" because it was in the past and you didn't think it relevant, but after talking to people decided to disclose it fully. You could also keep quiet, and then just hope that licensing isn't a huge problem, and then claim that you didn't think this would be an issue which is why you answered no.
What could happen?
1. Everything could be fine, and you have no problems at all.
2. You could run into licensing problems. Most likely, this would just require disclosure of your psych records, and might slow your license application but you'd still get it and start on time.
3. Your license could be very delayed, and delay the start of your internship.
4. You could be declined for a license. This is very unlikely. The biggest issue is that they could request your psych records, you might decline to hand them over (because of your privacy concerns) and then they would decline to give you a license. If so, you would simply "fail" the onboarding process, your program would request a waiver and it would be granted, and you'd be able to look for new spots or apply in the match again.
5. Your program could see this as an inaccurate reporting on your ERAS application. If so, and if they were to complain to ERAS about it, you could lose your spot and the ability to apply for spots in the future. This is unlikely, but possible.
In no case is there any "legal" action, other than you losing your spot or being banned from ERAS. You can't go to jail over this, or be fined, etc.