It's not necessarily "the state". It's more complicated.
They hire inexperienced people or companies for implementing and maintaining the IT infrastructure parts. They do this because they usually have to give at lowest costs (because of the laws) and still get some money back (corruption) or hire "friends" (still corruption).
Somebody hired for the job will do the minimum possible at minimum costs (see above), without any fears that they will be held responsible for anything.
If the infrastructure is hacked or broken, we get to yet another "maintenance/upgrade" cycle/contract like this.
If it's done with people, not companies, those are usually (at least in my country) hired for life, no matter how incompetent or lazy they are, leading - sooner or later to asking for the aid of a company too (in the terms already described).
This being said, I find it pure luck that there aren't more, bigger and worse hacks over the world.