The first person to get close enough to see the bottom of the pit would be attacked by the Gelatinous Cube as they aren't smart enough to wait in ambush either.
Would the pieces of a dead gelatinous cube actually paralyze you? Maybe it has to be surface membrane that does that.
Even so, everyone will get hit with the yellow mold spores if the room is only about 20-25 feet across.
This is definitely a Grimtooth trap, even if it hasn't been published as such, though I suspect it has been. It's something that causes a very likely TPK, and is rather extravagant of a trap.
From the viewpoint of killing the entire party, it's rather effective while still leaving a chance for survival, particularly if they refuse to save their friends and run out immediately, assuming another stone slab didn't block the doorway or anything. As to being a trap, it's kind of silly, but it fits for a strange evil overlord or mad architect.
As to being "fair"... In a game with this employed against the players, probably not. It isn't the job of the GM to kill off the party, it's to provide a story and challenges, again, not making more widows & orphans.
Of course that was prior versions of D&D. We are now in 5th edition, and things have changed some.
The cubes are no longer able to paralyze, but it does cause acid damage.
Being hit by the splatter would probably be equivalent to it's attack or trying to pull someone else out of the cube, 3d6 acid.
Since it's trapped in the pit, it can't engulf those around it, but if someone jumps, falls, or tries to climb into the pit, it's reasonable that they'd be automatically engulfed without a save. (If you were nice, you could give a save at disadvantage for someone entering the cubes space voluntarily.)
You no longer have to cast invisibility on it due to how it's transparency now works.
It takes a DC 15 perception to even spot it if it hasn't moved or attacked.
And again, it can still attack those nearby as it's pseudopod it extrudes to attack with has a range of 5', and that thing can come from any part of the cube that's exposed. (I'm sure it could acid attack the floor and walls of it's pit, but that's not going to help it against the players.)
There's a list of conditions it's immune to, and there's a mention that it tries to avoid fire, but it's not vulnerable to it.
If attacking the trapped cube, remember that it's going to automatically fail Dex saves as it is trapped in a pit it just barely fits in, not that a foe with a Dex of 3 is likely to save in the first place.
Speaking of saves, it's Int is 1 (not zero), and it's Wis is 6. Again, don't forget it's immunities to charmed, frightened, etc.
Also, the cube has NO damage resistances or damage immunities, nor does it have any vulnerabilities.
So you can slash it, bash it, burn it, freeze it, hack it, shoot it, and fry it with a lightning bolt if you want, they all work if you hit.
The Gelatinous Cube, the dungeons greatest ever janitor, except when it eats the rugs & carpeting...