Steps to reproduce
Create a flat world with simulation distance set to 4, and daylight cycle off (so monsters don't interfere).
Place a bed and stay near it.
Spawn a villager.
Set up repeating command blocks to kill all raid mobs.
/effect @s bad_omen
After each raid ends, repeat step 5.
Expected result
Each raid gets kill by the repeating command blocks. You can continue steps 5 and 6 indenfintely.
Actual result
Eventually, you'll have a raid that cannot be targeted by the repeating command blocks because it spawned outside of loaded chunks. That raid eventually times out.
Sometime, there will be a chance of wave spawns outside 4 chunk simulation distance or more than 64 blocks away in an unloaded area.
The changelog for 1.16.200.51 beta states that the raid spawning distance has been increased, so it may now be more likely for raids to spawn outside sim distance. This results in the raiders not moving toward the village, which means the raid may time out.
Update: this issue still occurs as of 1.17.11 Hotfix. From testing it appears that the changes made in 1.16.200.51 were minor and the most noticeable change was to limit the vertical distance raids can spawn above or below a village to 128 blocks. Horizontally they don't spawn anywhere near that far away.