Use Medite rather than mdf
‘Medite’ is just a brand name and they make all sorts of grades of MDF.
Amongst other grades Medite and Kronospan both make a moisture resistant MDF (MR MDF) which is sold with a green tint in it, which takes water based paint better than regular mdf, with the cut edges being less prone to fluffing and swelling when the paint goes on. There is also ‘medite exterior’ MDF thats used on shop frontages, boat interiors and the like. Its about double the price of regular boards, heavier (you wouldn’t think that would be possible) and has a tinted grey core. It cuts, routes and sands really well – a routed edge is as smooth as the face of the board, with non of the fluff.
Don’t confuse the exterior grade with Tricoya which is properly expensive and more than you’d need for anything being done indoors.
You’d need to ask your local supplier if they have any of the above boards. MRMDF is quite common but you won’t get it in B&Q, exterior grade is less available.
The other option though is using sanding sealer (shellac) before you paint. Its normally used as preparation for french polishing but with MDF its good for tackling the board’s enthusiasm for sucking up paint and going plump. A few coats with a sand in between consolidates the surface without swelling the wood and the boards end up feeling like they’re made of glass and all the cut and routed edges stay crisp and smooth.