Yes, to both scenarios.
The answer to your question is contained in the rules for the grappled condition instead of the rules for grappling (see Appendix A in the Player's Handbook):
The [grappled condition ends] if an effect removes the grappled creature from the reach of the grappler or grappling effect, such as when a creature is hurled away by the thunderwave spell.
In either scenario you have described, a creature who is "the grappler" and another creature who is "the grappled creature" have been forcibly separated from each other by "an effect" (instigated by the third creature) that causes the grappled creature to no longer be within reach of the grappler. The example cited is the thunderwave spell, but nothing says an "effect" can only be a spell since it's not a specially defined term in the game.
To be a little more thorough, note this wording from the rules on grappling (see Making an Attack in the Player's Handbook:
When you move, you can drag or carry the grappled creature with you, but your speed is halved, unless the creature is two or more sizes smaller than you.
This wording makes it pretty clear that you can move a grappled creature with you if you are using your speed to move, since it specifically mentions that your speed is halved. Since the third creature is pulling the grappler away from the grappled creature, the grappler is not using their own speed to move, so they cannot drag the grappled creature with them.
However, a DM would be reasonable to adjudicate this scenario a little differently if they feel the rules as written are not believable in this case. For example, they might feel that the third creature pulls the other two along with it like a chain. Or they might feel that the grappler in the middle should get a chance to maintain the grapple on the creature on the end of the chain by making an ability check or saving throw. That would fall into houserules territory.