The reason that I like TTRPGs enough to put in the effort to coordinate to play them with other people instead of playing things like CRPGs or MMORPGs is that you have an actual person abjudicating your interaction with the game instead of a PC. This means that you aren't limited to CRPG or Adventure Game style puzzles where you have to pixel hunt, find the one thing that works, or save and load until you succeed on a particular check. So not only will I modify published adventures, I think it's bad DMing to run encounters like you described as-written, because they play like CRPG encounters rather than TTRPG encounters.
The 'completely invulnerable door that only opens to two spells that the PCs might not even have, and might not have anyone who can cast' is an example of something completely artificial that doesn't IMO belong in a TTRPG. It's also really cheesy in my book that it's essentially asking 'do you have an arcane caster who took this specific spell? It's either trivial or impossible depending on your answer.' You can look at things like Is the door really invulnerable, or just warded - and what about the hinges, walls, floor, ceiling, and other pieces that could be taken apart or destroyed? If the players don't have a particular spell to get through a door and there's not a time limit, something like stonemason's tools or carpentry tools could do the job. Or the party can just wait outside until the mage has to come outside for food/water/rest-of-their-life.
The mostly immune creature should have some option to be grappled or restrained, lured away, hit with some kind of trap, or something along those lines. If it's so tough that the party really can't use other options without dying then it might need to be adjusted to be weaker, and if it's set up so that it can't be dealt with by anything other than a straight fight I'd definitely change that. Similarly, the end boss who's just immune to dying shouldn't be a 'do you happen to have exactly the right spell available and prepared' check, but instead that should be something the PCs can figure out, and if the party doesn't happen to have the exact spell there should be some alternative way to disable his death immunity - possibly things like restraining him or trapping him.
Another example from a published adventure that I change: there's an AL module Tales Trees Tell where PCs have to go into an angry hag's woods and attempt to talk her into something between don't kill us, don't kill the town, and keep helping the town in the big crisis that's coming. It's a great atmospheric adventure with a lot of Grimm's Fairy Tale type of horror most of the way though. But as written, at the end the party has to make at least half of a party-wide set of persuasion checks that will probably average about 50-50 if the party plays well and only has one 'face', and if they fail the Hag fights them in a fight that's pretty easy to win and then leaves. It's dumb both because it's pretty much just a coin flip for success/failure, and because the hag should be someone the party is terrified to confront, not someone they easily best in a fight. I completely redo the ending when I run that module and instead of a bland persuasion check roleplay out the bargaining with some persuasion helping determine what happens, and if they do completely fail to reach a deal, they just get the 'now I'm your enemy' bit instead of an easily cleared fight they can win.