Despite their entirely different names, player.cursor and horse.chest function exactly the same. You can set the chest of a donkey with player.cursor and detect the player's cursor item with horse.chest.
This also applies to player.crafting.(0-3) with horse.(0-3).
Steps to Reproduce
Summon a donkey.
Run the following command on it:
/item replace entity (donkey's uuid) player.cursor with minecraft:chest
Observe as a chest gets placed in the donkey's chest slot.
Run the following command on it:
/item replace entity (donkey's uuid) player.crafting.0 with minecraft:stone
Open the donkey's inventory and observe that the first slot has been replaced with stone.
Code Analysis
Both player.cursor and horse.chest use slot id 499. Both player.crafting.(0-3) and horse.(0-14) start at slot id 500. Shifting the IDs of one set over should fix the issue.
Thank you for your report!
After consideration, the issue is being closed as Won't Fix.
Please note that this is not the same as Working as Intended, as this bug report correctly describes behavior in the game that might not be the intended or desirable behavior, but it will not be fixed right now. Sometimes, this is because the issue reported is minor and/or impossible to change without large architectural changes to the code base.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki