Maybe the explanations are simplified but I don't quite understand how the immune system could fail to recognise permutations of proteins or any other differentiating factor between COVID-19, its variants and mRNA vaccines; nor what makes this specific example of vaccination riskier.
The reason the second infection is so bad is exactly as outlined above: your immune system 'recognises' the second variant and produces antibodies that it learnt when fighting off the first variant you recovered from. Unfortunately, these antibodies are useless against the second variant, and you have a bad time.
This exact same issue happens with the current vaccine for dengue, which is why it is only given to people who have already had dengue of some kind, or in populations where most people have had it before. For a situation where this did not happen see the section titled 'Phillipines controversy' in the wikipedia article.
There is currently a lot of work being done to produce vaccines that protect against all 4 variants at the same time, with some promise for the years ahead as trial results come in!
Now the real virus shows up, your body goes "Aha! I've seen this before let me make those antibodies." But it wasn't trained on the real virus, so the antibodies it makes aren't actually effective against the real thing. The virus replicates and your body makes more and more antibodies but they do nothing to stop it. Meanwhile the the antibodies are running rampant in your body causing inflammation and blood clots.
This has happened before with vaccine candidates, and is analogous to what goes in on severe covid. The body tries to respond to the invading virus but does so ineffectively and causes potential deadly damage.