As kviiri pointed out, the rules as written do not say that an engulfed creature is affected by whatever affects the creature which engulfed it. However, when your DM insists to house-rule that they do, you have to live with that.
However, house-rules should usually be open for negotiation.
When your abilities require an attack roll, you could agree that trying to hit the cube without hurting its engulfed victim might be tricky, but not impossible, especially considering that a gelatinous cube is transparent and your characters can see where the victim is so they can try to hit other areas. This could be represented by first rolling to hit the cube and when the cube was hit successfully rolling a second time to not also hit the player (where a successful role means no damage and an unsuccessful role means an unintentional hit).