that's kinda how the French retirement pension works
they've got a lot of funny little things in that make it not exactly simple ------------ but, basically you get as a retirement what you get depending on what you put in over the years.
you get it forever, ---- if you win a billion in the loto ------ your pension continues unaffected.
It's not perfect and they do fiddle with it and there's some things in it which you think ??? hmmmm? good idea or not - but, overall - it works basically as you said