It looks as though they have a bug fix for this now:
Build: 1.17.1-37.0.40 - Thu Aug 19 05:44:39 GMT 2021 sizableshrimp: Fix entities not spawning in structures (#8020) This affects swamp huts, pillager outposts, ocean monuments, and nether fortresses