You took 48 strength Mamluks and ran over 50 strength Legions? Unless it was 6 Mamluks against 2 Legions, I don't understand.
I was forced to attack a Greek player once with a Mamluk rush - my land was super bad, coastal tundra near flat desert and flat plains. Fighting Hoplites isn't ideal, but I nabbed two Great Generals with district projects, spent like 500 gold upgrading 7 or 8 58 strength Mamluks against 45 strength Hoplites (vastly cheaper and more numerous of course), and didn't break through, even with several more Mamluks reinforcing. I was one turn from taking the first city when walls got completed and shut me out (I think melee does 15% damage against walls?), and then within 7-8 turns or so he had a few of his own knights on the field via upgraded chariots - which makes a fair amount of sense, because the only timing advantage Arabia really has is not needing to tech Bronze Working (in which case you also are not building an encampment and bringing any GG's, like I did). Maybe my bad land didn't help in this instance and I'm sure somehow it could have been executed better (I'm pretty sure I was in the early 40s of turn time but can't remember exactly). I don't know if I'd call it a crap rush, but it's nowhere near unstoppable.
The equilibrium in the game favors the defender, and a Mamluk rush doesn't do enough to disturb that equilibrium (even in a best case of fighting 35 strength units before 40 turns). I think a standard civ taking a slower combined-arms approach with crossbowman, some knights, a siege tower, and a GG is better positioned to be successful.
In my mind, if you end up reducing Arabia to mainly playing for the Madrassas - 5 science an era earlier - why is Brazil so bad? They stand good odds of being able to build 2 Campuses with +6 adjacency, and then they can run the double-adjacency card just as early (and still tech military), with less production investment, and go on to create their own Musketman or Cavalry beeline rush.