There are many different types of capacitors, most of which don't contain any liquid at all (including the most common type - ceramic capacitors).
But in general, you would use specially rated components and materials if you need them to last decades - not the cheapest most basic parts you can find.
Other types of implanted devices have dealt with the same things decades ago.
Pretty sure these things need to be certified and there are laws about what parts you are and are not allowed to use.
Not saying highly regulated industries don't ever have problems (look at Boeing), but it's not like they can just arbitrarily decide to cut costs wherever.