I have no clue, it confused me a lot. It could be possible via that way tho.
It actually is; but I'm unable to show you how it works from both perspectives as it is 2 AM right now, if you're interested I could do so after a day or so to show you how it works:
You were shifting all the way to the end of the block, having a small part of your hitbox to be outside of the little corner, making it very possible to be hit from that way. I've seen youtubers do it, and I've used that exact tactic to fight some certain mobs in the nether; it's very much possible with both a sword and a bow, because, again, your hitbox is a tiny bit sticking out of the little corner (since you were crouching all the way to the end of the corner.)
I hope this explains to you how it's actually done, if not I'll be sure to make a quick video of both perspective tomorrow as I wake up. I can assure you, it's no hacks nor luck, unless the player was lucky to have the arrow hit your head just barely.