Funny thing. I left out a lot of details in my explanation of how to do this trick In the interest of brevity. There is an easy work around. Stick your hands in the bag while casting the spell. One of many details i left out.
I think the wording is unclear on whether that is possible or not. For instance "where you cast the spell"...is that where
you are (and if so, what does that mean) or the location of the object/target/center of the Glyph?
But that is just one of several things that are unclear about this trick (and your workaround), AFAICT.
... its unspecified what exactly is required for Somatic components. A BoH opening is only 2ft in diameter. Does that constrain the Somatic Component?
...the interdimensional space inside a BoH is odd. Its geometry is undefined. So can objects inside even interact with each other? If not, how do lifeforms inside it breath (as specified in the description)?
...you must be holding the Material components (and the object) while casting. But if you insert an item into a BoH it goes into the interdimensional space awaiting retrieval. i.e. Is it even possible to "hold" an item in the weird space inside?
...your hands are part of you, and the description doesn't talk about the BoH like something can be sticking partway out of it. Its either in or out. So...it may not even be possible for you to stick your hands in without entering the bag entirely. Not a hindrance for casting AFAICT, but you need someone to pull you out.
But most importantly...
...what precisely differentiates an "object that can be closed" from a "surface"? Just about any object I can think of (closeable or not)
has a surface. So...If I declare that I'm casting it on the
surface of the book rather than the book itself, the object and movement restrictions don't apply? (The spell even gives the example of a table as a surface...to which someone on the interwebs suggested ripping the legs off and having the muscle carry it around.) If I declare that I'm scribing the glyph on the
surface of this piece of paper, can I fold it into a paper airplane and use it as a missile? If so, then all the shenanigans with the BoH are pointless, because the trigger conditions are totally open: "When I have thrown this acorn and it strikes a creature." seems perfectly legit to me, so long as you specify that you are casting it on the surface of the acorn.
All in all, this is a DM call, either way, IMO. Certainly the relevant wordings allow for multiple interpretations.
Play however you see fit, I guess.