I just upgraded your design with a few modifications and it works even better. It's so OP! It is now a 3 by 3 by 3 hole. First, waterlog the first 2 layers. In the middle of the bottom layer put a scaffolding block and surround each side of the scaffolding with 4 bottom slabs, 1 for each side. Put any block on top of the scaffolding which this is the second layer. On the top layer place 7 glass leaving one for the upside-down dispenser with a button on top and the middle being water with armor stand in it. Problems I fixed: entity cramming does not limit this farm anymore, only how fast the player can pickup XP can which is an unfixable problem for all XP farms. I also made it so that really powerful swords does not hurt the allays. The armor stand does not break from fire aspect too.
For anyone who cant get their piston to break crops, for some reason your piston should face north or south preferably south because thats how i got it to work :D
for this to work for me i had to manually destroy some of the pumpkins then everything started smashing if u place observers after ur pumpkins grow but other then that everything works great