Is there realistically anything I could have done or do Beastmaster rangers have to accept that if their beast companion dies they will be sitting on the sidelines until they can replace it?
RAW, it's the latter. Risking your resources against challenges is a big part of the game.
Beastmasters get some special advantages from their class features, as do any characters with class levels. Whether or not those features are balanced with one another across classes (by which I mean, is a Wizard as "good" as a Beastmaster) is a more nebulous question, but each class still specializes in certain ways and can be in trouble if something precludes their specialized capabilities.
For a Wizard, it's all about spells. If a Wizard PC chooses a not-very-useful set of spells before a dungeon dive that doesn't allow a long rest, they will be less effective than they might have been and have a harder time than they might have had. If the Wizard burns their spell slots early, they'll have a lot less utility later on. If they find themselves in an area filled with antimagic fields, or encountering lots of enemies with magic resistances, then they'll be much less valuable in their typical role.
For a Beastmaster Ranger, the specialization is in the beasts that they master. Your animal companion dying, while not necessarily preventable, is a situation akin to a pure Wizard being silenced, in an antimagic field, or in some other way having been prevented from using their spells. Especially if you're specialized around the animal companion, keeping that companion alive is as important for the Beastmaster as spell management and ability to cast spells are to Wizards. This dungeon may have been especially difficult for your character, since no suitable replacements were available.
In any of these cases the player's choices, and their circumstances and luck, impact which of their resources they hazard at a particular time. It may be necessary to risk an animal companion (or a PC companion!) to overcome an obstacle, and then you have that much less to bring to bear on future challenges. That sort of resource allocation is a very important element of the game, and not every risk pays off.
I say all of this not to put down the Beastmaster class specialization, but to highlight that the animal companion is a high-value resource which may not always be available. In the same way that a Wizard will use spell slots to advance in the dungeon and then not have them available afterwards, a Beastmaster's companion will help the party advance but might be "consumed" in doing so. It's easily fixed during downtime, but in an adventure featuring time pressure the inability to get a new companion might be similarly vexing as a Wizard's inability to take a long rest and restore spell slots-- whittling away at the party's resources is part of the adventure's challenge.
What can you do about the Beastmaster's vulnerability to losing their animal companion?
Having a list of options to resurrect the companion is valuable, though doing it mid-dungeon crawl may require assistance and investment from others in your party.
Being slightly less specialized around the companion may also be an option, depending on your tastes. Going all-in on the companion is an all-your-eggs-in-one-basket proposition, and the risk of that is that they all break at once and you're down to crossbow fire.
Most importantly, talk to your DM. The key angle is that your character is based around the animal companion, and presumably a good portion of your fun is related to that as well. Because the companion is a special class resource that can't be restored as easily as others (like by simply taking a long rest), your character may be particularly brittle relative to the other PCs. If that's impacting your fun, as seems to be the case, your DM may be willing to work with out to remove some of that brittleness.
I disagree with your DM's call that only PCs can make death saves. This is explicitly contrary to the published rules, which make no such restriction, but even if this were untrue (or your DM simply handles their table that way) a special accommodation could easily be made for the animal companion. Other options exist to make your character build a bit more resilient, such as UA's Revised Ranger allowing for a particular fallen companion to be restored over a long rest.
What can you do, generally, when your specialization is ineffective or unavailable?
There's no question that being deprived of your character's specializations takes some of the excitement out of the game-- those are what make your character shine! But even if your character is not able to do what they do best, they can still do a lot to help out:
- Healing is a big deal. Many combat situations expect the party to
replenish HP, and even if it isn't your favorite thing there's no
cause to feel bad about "just" healing.
- Helping. It's situational, but using the Help action to assist
party members can also be valuable. Advantage is a meaningful
- Drawing fire/Engaging enemies. If your character has good AC, and/or
can take a hit, engaging an enemy can be really useful. It
potentially limits enemy mobility, and helps spread out enemy damage
output rather than concentrating it on the rest of the party. I've
had players do nothing but Dodge for rounds at a time, soaking up
enemy attack actions without actually taking damage.
- Attacking. Damage adds up, and a single crossbow bolt can make the
difference between a successful fight and a catastrophe.
- Grappling. If your character has the attributes for it, grappling an
enemy can take them out of the fight for a time.