I was wondering why 0-tick farms were not permitted because I thought it would be a great farming method. But even if it is, could I use it for other purposes? Like for example, making a terrarium?
(This isn't my house, I found a screenshot on the internet.)
There are a few reasons that zero tick farms aren't allowed. Basically how a zero tick farm works within the context of Minecraft is it forces a tick update before there should possibly be able to be one. It sort of utilizes a bug within the ticking code for Minecraft (so you already have a strike against it, since you're technically using a bug). and allows something to tick multiple times per server tick (server ticks once, machine ticks 5 or 10 or 20 times)
They are also really really laggy machines. Sure, one cactus ticking every 10 minutes or so is no big deal - one cactus ticking 50 or 60 times a second is a lot bigger of an issue (to say nothing of the machine itself ticking that fast, or having 10 cactus on there instead, or 10 players with 10 cactus etc etc).
In regards to your 'terrarium' - I've seen that too where you push the glass block onto a mob and that mob gets stuck inside, I find it kinda neat. I - personally - look for reason behind 'mild' rulebreaking. While making a zero tick machine for the sole purpose of a decorative build you physically cannot produce otherwise isn't a huge deal (it's not in constant use like a farm would be), I would still heavily suggest refitting your design rather than trying to skirt the rules to create it.
Besides, seems cruel to the animals, give them some grass and room to hop around, maybe a little tree