Hello, I'm trying to parameterize the subdivisions of a cube and more, any ideas?

I’m currently trying to make a parametric model where you can change the amount of subdivisions of a cube/mesh, as well as hide a random number of those subdivisions (for example hide 30%, and maybe different seeds).
The only way I know of how to make a subdivided cube (like a Rubik’s cube) is to use particle system or use array modifier in all 3 directions, but there you can only delete the subdivisions manually which is not exactly what I want.
I thought it might be possible to do this with geometry nodes, but I’m still new to blender so I wanted to ask if maybe any of you know how to do this?

I think this sound like a advanced goal to do. I have almost no knowledge with scripting, but maybe someone who is fluent in scripting would have some idea. Only thing I can think of is somehow using shape keys, I dont know if its possible to use that way you want.
Parametric modeling can be done via modifiers. There is a modifier that adds subdivision as well as simplifies the geometry by percentage.