For example, if you spawn a baby zombie by using a spawn egg on a zombie in a boat that is filled (i.e. there's another entity in the boat), the baby zombie will go into the ground and suffocate.
Video
[media]Code analysis
Code analysis by @unknown can be found in this comment.
Related issues
Attachments
Comments


Can confirm in 21w03a.
Can confirm in 21w05b.

It seems to be partially fixed in 21w05a as the villager does not go straight under, but you can see the top of his head for some/all of it.
Can confirm in 1.16.5.
Can confirm in 21w16a.
Can confirm in 1.17.
Can confirm in 1.18.1.
I can confirm this behavior in 1.18.2 and 1.19 Pre-release 4. It's important to note that this issue can be seen with any ageable mob and isn't just exclusive to villagers. Here's a code analysis regarding this issue.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.19 Pre-release 4 using Mojang mappings.
net.minecraft.world.item.SpawnEggItem.java
public class SpawnEggItem extends Item {
...
public Optional<Mob> spawnOffspringFromSpawnEgg(Player player, Mob mob, EntityType<? extends Mob> entityType, ServerLevel serverLevel, Vec3 vec3, ItemStack itemStack) {
...
Mob mob2 = mob instanceof AgeableMob ? ((AgeableMob)mob).getBreedOffspring(serverLevel, (AgeableMob)mob) : entityType.create(serverLevel);
...
mob2.setBaby(true);
...
mob2.moveTo(vec3.x(), vec3.y(), vec3.z(), 0.0f, 0.0f);
...
If we look at the above class, we can see that when a spawn egg is used on an ageable mob, the new baby entity is spawned at the parent's location. This is evident through the following line of code:
mob2.moveTo(vec3.x(), vec3.y(), vec3.z(), 0.0f, 0.0f);
When a given entity is in a boat, its hitbox isn't shortened (MC-80877) and because of this, it penetrates the bottom of the boat. Since an entity's position in the world is determined by the bottom center of its hitbox, this results in the newly summoned baby entity being placed at its parent's position (which is too low down when they're inside boats) resulting in them sinking through and suffocating in the ground when summoned.
Can confirm in 1.19.
Since the height at which some ageable mobs sit in boats was changed in newer version of the game, this issue is now exclusive to zombies, zombie villagers, piglins, and zombified piglins.

This issue now very much relates to/is caused by MC-80877.

This issue now very much relates to/is caused by MC-80877.