Sharing referee/AE report online to point out a grievous error in refereeing
For the sake of science [...], I intend to upload my paper, the referee report and the covering letter of the associate editor (all of whom are anonymous, BTW) on my website and on researchgate. Alongside this, I plan to upload an explanation explaining why the journal was mathematically wrong to reject my work.
Besides possibly being a copyright infringement and coming across as immature, this isn't really going to contribute anything to science. Your paper is not going to attract a significant audience if it's only on your website and researchgate. arXiv would be slightly better, but not much.
Your contribution to science is the paper itself, so the best way to handle this situation is to revise your paper to make it more clear, particularly to a reader who may have the same misconceptions as the reviewer did. Then submit it to a different journal.
To be clear, I do not think it is a good idea to post an explicit rebuttal or criticism of the referee's report, with or without the report itself, on your website or in any other public forum,. It is unprofessional, and it will cause people to focus less on the content of your work and more on your negative reactions. You can rebut their concerns indirectly within your paper itself ("it may appear that X, but in fact this is not true because Y"), but do not "call out" the referee or the journal.
I'm sorry about your bad experience. However, your proposed course of action makes you look petulant and childish. You're not going to make any friends or impress anyone. Trying to tell the world that the editor and referee were wrong is just a waste of your time. Everybody has misunderstood a paper at least once in their life and, sometimes, you get unlucky and misunderstand a paper that you're refereeing.
Wait a few days, then see if the referee doesn't actually have a point. Communication failures are rarely 100% the fault of either party and, even if it's mostly the referee's fault that they misunderstood, you can probably still make your paper clearer, so other people don't misunderstand it in the same way. Do that and resubmit the paper somewhere else.