Although contests are RAW, how to run a contests is explicitly made the DM's responsibility via their own good judgment of the specific situation at hand. That means that, RAW, as soon as a contest is on the table (so to speak), it's in the DM's hands to make any and all adjustments necessary for it to make sense.
In this way, the rules are — again, by RAW — not telling the DM how to do it, only giving them a basic tool to riff off as necessary. Some situations will call for using that judgement to give a stunned character the chance to oppose a grapple, while most situations will probably not.
It might have been nice to have corner cases like this nailed down instead of punted to the DM, but relying on DM judgement is intended to be a feature of 5e, so this is quite intentional. DMs are smarter about the situation in front of them than a rulebook could ever be, and 5e's design intent is to harness that constructively.
Yes, this was tried in D&D 3.5e as a variant rule.
An officially published version of this rule existed in Unearthed Arcana, a 3rd edition D&D manual of variant rules. It can be used essentially unchanged with the 5th edition.
Unearthed Arcana p.133:
Players Roll All The Dice [...] Attacking and Defending
With this variant, PCs make their attacks just like they do in the standard rules. Their opponents, however, do not. Each time an enemy attacks a PC, the character's player rolls a defense check. If that defense check equals or exceeds the attack score of the enemy, the attack misses.
To determine the creature's attack score, add 11 to the creature's standard attack modifier (the number it would use, as either a bonus or a penalty to its attack roll, if it were attacking in any ordinary situation using the standard rules). For instance, an ogre has standard attack modifier of +8 with its greatclub. That means that its attack score is 19.
To make a defense check, roll 1d20 and add any modifiers that normally apply to your Armor Class (armor, size, deflection, and the like). This is effectively the same as rolling a d20, adding your total AC, and then subtracting 10.
- Attack Score 11 + enemy's attack bonus
- Defense Check 1d20 + character's AC modifiers
If a player rolls a natural 1 on a defense check, his character's opponent has scored a threat (just as if it had rolled a natural 20 on its attack roll).
Note that in D&D's core mechanic, a d20 roll that exactly matches its target DC is considered to succeed -- ties go to the person rolling the dice. So letting the defender roll actually gives them an advantage if you convert the numbers naïvely. This is why it's necessary to add 11 rather than 10 to the attack score to preserve the usual odds.
From the rules for Inspiration in the Player's Handbook, p.126:
If you have inspiration, you can expend it when you make an attack roll, saving throw, or ability check.
So you can't use inspiration to give yourself advantage on a defense roll. This matches the usual case, in which you can't use inspiration to give an opponent disadvantage on an attack roll.
Best Answer
Does dodge allow a player to do a Dexterity Saving Throw when attacked?
No, it doesn't. When you use the Dodge action, two things may happen:
So using Dodge action don't make you roll a Dexterity saving throw when attacked, but it still make you harder to hit.
Besides avoiding trap effect, when would you do a Dexterity Saving Throw?
Mostly when you are subjected to spells that require you to do one. This depends solely on the spell.