Words don't usually change in a one-off way. If you see a change from m to w in one word, you're likely to see it in another word in the same language. For example, in going from Proto-Germanic to English there was a general shift to drop the sound n before fricative sounds, as is apparent in multiple words: English five vs. German fünf, English us vs. German uns, English soft vs. German sanft. In the case of mid and with, we don't see other instances of m turning into w. Coupled with the fact that mid and with used to coexist, and they have plausible etymologies arising from independent sources in Proto-Indo-European, the preponderance of the evidence is for independent origins for the two words.
It is quite clear from the etymologies that both words already existed for aeons in English and its ancestors. So there is absolutely no corruption going on "in the first place". What is, however, possible is that their similarity was a factor in their merging. That is something that happens occasionally.
Both words exist in Swedish - med and vid, and med means "with" and vid means more like "at".
Vid isnt closer to “by”?
(Asking as a Norwegian, since “ved” is “by” or “beside”)
yeah - it can mean "by" too... it has a number of meanings. It is the usual "almost but not quite the same as" you get when languages and prepositions diverge. Norwegian and Swedish are pretty similar, except when they are not.