Maybe you could add more velcro - put it all the way round?
I think that's the cheapest option. You can get the stick on velcro and do a double row all the way round. Or stitch a few laces to the bottom of the mattress and the bottom of the cot and tie the mattress on underneath.

I find that my mindee does this sometimes, I leave them to go to sleep by themselves and check on them after a few minutes and sometimes find she's managed to wiggle the mattress down so it's folded at the bottom of the cot and is asleep on the base of the cot. I just move her back on top of the mattress and she stays asleep.

All my mindees sleep on their knees like you mindee does when they're in the cot but they're all still happy to sleep in the buggy too.