The bug
(a) In a world where dragon was never killed before, travel to the exit end portal.
(b) In a place where the dragon egg is supposed to spawn, completely fill this place with a column of dragon immune blocks (example: obsidian) all the way to 255 until you recieve a message that no block may exit higher. Example:
[media](c) If step b is not done, the dragon egg will spawn on the highest block
(d) Execute the following command:
/kill @e[type=ender_dragon]
❌ The exit portal activates but dragon egg fails to spawn. Potential solution would be to force dragon egg to replace a block at y=255.
Can confirm. This also affects 1.16.5.