Keeping companions alive is about managing their pathing and potential morale failures.
NPC pathing doesn't consider the environment. They may jump into a waterway at day's end, chasing after some critter, only to get frozen in a block of ice, or enter a waterway with rapidly changing flow amounts and drown if they haven't the swimmer levels to manage negative statuses like being winded/tired, etc.
In combat, NPCs path to their target, then presuming no morale failure, will unload attacks governed by escalation level. This means they fight everyone in one of two ways, with weapon/shield strapped or out & readied, irrespective of situation, position, or opponent type. NPCs may path into melee versus multiples, giving up side/back positioning which will result in their injury or death. If they experience a morale failure, they'll give up their back in an attempt to flee. Side and back give ups naturally result in huge bonuses to opponent attack roll; companion skill/stat training (even at extreme levels) becomes moot.
So it's all kinda about keeping them away from things.
When it comes to travel and environment, particularly waterways, the only safeguard is never dropping into slow travel near a waterway at day's end, or if approaching one when freezing isn't an issue, monitoring flow amounts and vision arcs from a 21-25 tile distance. Once you're 20 tiles or under, your companion may perk up and target some poor aquatic critter.
For combat, the only tool is having them wait to avoid bringing them into melees they'll potentially fail/disrupt.
Plenty of micromanaging fun. That all said, you can solo game a bogeymen governed world with good planning. Depending on your playstyle that's either the way to go or a deal breaker.