I tested it only in the Nether, but it seems that when difficulty is set to peaceful, and then set back to any other difficulty using /difficulty ...
, hostile mobs won't spawn until the world is reloaded or the difficulty is updated within the options screen.
More detailed steps to reproduce the bug
Find some hostile mobs spawning
Set difficulty to Peaceful, either in options or by command
Run
/difficulty normal
❌ No monsters will spawn while just in Normal difficulty
Reload the world or update the difficulty using the options button (not just cycling it, and not to peaceful)
✔ Monsters will spawn again
It seems to me to be the issue with having walls so close by that mobs can't spawn where you would see them