The standard way of dealing with these matters is that your conveyancing solicitor would submit management enquiries to the managing company (ie. the council) this would illicit information on previous expenditure and future anticipated expenditure. It would obviously be to the best of the MC's knowledge and obviously matters can subsequently arise which neither owner nor MC could anticipated. Under the lease you would be obligated to contribute (with others) to the cost of such works.
The enquiries would usually ask for accounts for the previous three years to show the expenditure and would also refer specifically to significant outlays like that to which you refer. The amount does seem fairly exceptional and one would think that a cost of £20k per owner would be a cost that only comes pretty rarely.
In the final analysis such costs are part of the vagaries of owning block managed leasehold properties and there is little getting around it, so you have to accept an element of risk and chance your arm.
You can protect yourself to some extent by seeking confirmation that no future works of that order are planned and looking at previous expenditure, but this does not take account of unanticipated costs stemming from matter which the MC did not/could not know about.
If there are other anticipated works then you should receive an estimate of the cost so that you can budget and/or make a decision on whether to proceed.
A further way of protecting yourself is to commission a full structural survey of the flat, this will include some commentary on the state of the structure. This should reveal any defects which could lead to further costs being incurred.
My advice would be to ask to see copies of any management enquiries made of the council by your solicitor and check that previous/future expenditure information has been requested, together with considering whether to commission a structural survey of the property (note - this is a lot more detailed than any mortgage valuation carried out).
Any future buyer will be faced with the same decision to me as you. All block-managed flats are I'm afraid.
If this is useful please kindly click accept so that I may be rewarded for my time. It will gratefully received and you will be free to ask follow up questions.