I did some more digging, and it turns out this is a more complicated issue than it seems. I place a massive 384 by 384 grass block plane in a world with no blocks. Not a void world, but a superflat world with all of the blocks removed. When I tried to place a pyramid in this world, it failed every time. Then, I created a world with 128 layers of air and 1 layer of grass blocks. The pyramid was miraculously a success. After that, I removed a massive area of grass blocks, exposing the void. I attempted to place a pyramid, and it worked. The pyramid was directly placed onto the void. When I tested it in the end, I could only place it in areas where the treasure room wasn't exposed. I tried applying this to a block-less world by creating a 128 by 128 by 128 cube. It failed.
The issue seems to be that desert pyramids can only be placed in the overworld when the world has been generated with blocks at least 4 blocks above the void. The world cannot generate with the void exposed at all, or else the desert temple will fail to generate. It can however generate on the void when the specifications are met, and it can't be placed in a world when the specifications are not met whether or not new blocks are placed. It can also miraculously generate in the end, and I'm still not sure how that works.
Right, forgot to respond. I had tried it in many other worlds, including ones with similar attributes to void worlds, but technically not. One such world was a single grass block plane 128 blocks above the void. The pyramid managed to place in such a world. In the void world, I tried to place a similar massive plane, but it refused to place no longer how large I made it. It could also be because structures were off, although the pyramid was still able to be placed in the nether. Now that you mention it though, I'll do some further testing.
This is caused by the new feature allowing Allays to easily travel between the nether and the overworld. For whatever reason, whether in another chunk or leaded, when the player enters the nether and the allay can't the allay becomes broken. This also happens when a world from an older version is loaded in a newer one, especially on a realm.
This bug can be temporarily fixed by removing the item from the allay's hand, punching them, and giving the item back. This is only a temporary fix, as the player entering the nether will cause it again.
Oh boy, I hope it doesn't have the same fate. That previous place structure issue was marked as a bug they won't fix. I find it so odd that the place command depends on so many specifications. The whole point is to place any structure in any location, but in many cases it fails tremendously. I seriously hope they fix this.