In a university it is the job of the professor to communicate what is necessary to complete the course on behalf of the university. You disclosed all facts necessary to all the appropriate people to allow objections to be made to what you did, and there were no objections. You completely all class requirements that were requested from you. You mastered the material and you disclosed your prior knowledge should the university feel that it was not fair to let you take the course. There is no law telling them exactly what their requirements must be or how they should go about determining that you have met them. They have to have their overall academic program evaluated every few years to see if it is rigorous enough to continue to be a university or college, but accreditation review doesn't involve binding promises about how the university will conduct itself in the future and doesn't involve micromanagement of individual students living up to a particular standard.
Universities routinely allow people to test out of classes where they have mastered the material before going to college and give them credit for these classes. For someone who takes a lot of IB or AP classes in high school, it isn't terribly unusual for a university to give someone a full year of college credit in this way. The way that this was handled in your case was a bit clumsy, but morally, giving you credit for a language class that you didn't show up to based upon near perfect scores on an exam is really no different that giving you AP credit because you took an AP class in that language in high school and got a high school on the AP exam.
When I was in college, I was comped out of a course requirement by being paid to grade papers for that class for a semester and showing that I could do so competently. This institution was a bit more clumsy about it, but honestly as long as you told them all the relevant facts, its up to the university and the professor to decide what you must do to pass. And, if the professor reported you because the professor believed you broke some university regulation, the professor would have to admit to being completely complicit in doing so with full knowledge of the fact and would be in much more trouble than you.
More selective colleges usually don't grant credit based just on life experience, but even that isn't that unusual. Many colleges catering mostly to non-traditional students allow them to test out of classes (including language classes) based upon what they learned in life on the job or in the military, even without any proof of having had formal instruction in the field. It is uncommon to give credit for competence, but it is hardly unheard of or highly unusual either.
You are getting a little break for knowing a language other than the main language of instruction which is not a big deal in light of the fact that you took all of your other classes in a second language at the college level, which is a far greater hardship.
If the professor says you passed the class, and the university awards you a diploma, then you've met their standards and earned it and there is nothing to be ashamed of, let alone to fear that your degree could be revoked based upon. Likewise, you should not feel that you have committed any form of academic dishonesty.