Kamikaze
This custom challenge makes you unable to deal melee damage, but grants you leather boots with thorns 30, which is decreased to thorns 5 once you enter the end. Now your main way to attack mobs is to take damage from them. These boots cannot be removed, and equiping other boots will simply replace them with new leather boots.
This data pack was originally made for version 1.17, but it still works up to 1.20.4 (and probably later versions if you're reading this in the future).