Do shulkers despawn in Peaceful Mode?
Solution 1:
That's strange, as Shulkers shouldn't despawn at all. Nor should they ever respawn.
According to the Minecraft wiki:
Spawning
Shulkers spawn during the generation of end cities, which are located on the outer islands of the End. They usually spawn on the walls of the city and on end ships. They do not despawn naturally, even in Peaceful difficulty, and once killed, they do not respawn unless spawners are used.
In Peaceful difficulty, shulkers exist within the world, but do not attack, like vindicators and evokers.
Meaning it's especially confusing that you encountered both despawns and respawns.
I can only assume that the shulker that despawned initially actually teleported away:
When at less than half health, a shulker has a 25% chance of teleporting (as described above) after taking damage. When a shulker is attacked, other shulkers in the area target the attacker as well.
But I have no idea how you managed to get multiple despawns during testing.