It’s normal for the DM to improvise new rules to make the game more interesting. I’ve never told somebody that they couldn’t use acrobatics to escape a grapple, but I’ve said similar things.
For example I’ve said: “After the wolf knocks you over, it moves onto you and now it’s standing on your stomach, so you won’t be able to get free just by spending half your movement, you’ll need to make a check.” That’s not an official rule, but I wanted being tripped-by-a-wolf to have more game impact than just spending half your movement on your next turn to stand up.
I’ve also done the thing where I improvise new rules simply because the environment seems to call for them. For example, when someone jumped onto a roof, I’ve said: “you’re pretty heavy, and this roof isn’t very well built. Give me an acrobatics check to see if you fall through the roof.” There are no rules for that, so my player might have viewed it as “changing the rules to punish the players”, but I wasn’t trying to punish him, I just wanted to make the game interesting.
I’ve also done the thing where the group kills all my monsters too quickly, so I narrate that actually there were more monsters hiding somewhere and now the group has to fight them too. It sounds like this might be what your DM did.
My guess is that, when doing this, your DM forgot that someone had high passive perception. (Or they decided that passive perception wouldn’t work on a creature that was hiding underground.)
The DM is allowed to do things like this, so long as they are doing it in order to make the game more interesting and fun. The DM should be doing this in order to change “that combat was too easy” to “that combat was about the right difficulty”.
In this instance it sounds like the DM could have handled it better. For example, instead of saying “there’s an ankheg and none of you noticed it so it gets a surprise round”, the DM could have said “there are TWO ankhegs and your character who has 21 passive perception notices them so there’s no surprise round”. It sounds like either of those choices would have led to about the same combat difficulty, and the second one avoids nerfing a character’s perception ability.
The DM also should try to avoid improvising new rules in a way that consistently hurts one player, because then that player might feel like they’re being treated unfairly.
We can’t tell you whether you should stay in your game — it’s up to you to decide if you’re having fun. But, if I were in your shoes, I’d stay in the game and try not to let it bother me.
If I started to feel like my character could never do anything useful because the DM was always improvising rules to thwart me, that would be when I would leave the game.