The maggots should not be climbing on the lid and trying to get out. If this is happening, there is too much humidity in the container.
When I first started culturing fruit flies, I didn't have any excelsior and I ran out of coffee filters. So I used shredded cardboard. The problem is that the shredded cardboard absorbed all the moisture and got soaked so the humidity was too high in the container. The flies died off and the maggots climbed to the top and literally starting forcing their way through the mesh lid. It was pretty disgusting to see this when I opened the lid. Maggots all over the lid and coming out.
Since then I have always used excelsior and I have never had any maggots climb to the lid. They will crawl up the sides, maybe 3/4 of the way and pupate.
Here is some info from Josh frog's regarding humidity in fruit fly cultures:
By looking at the placement of pupae on the side of a culture, you can infer if the culture is receiving the proper humidity or not. Under ideal conditions, the pupae will be spread evenly throughout the sides of the culture, with most of them located at mid level. If most of the pupae are located at the top of the culture, the humidity is too high. If the pupae seem concentrated lower in the culture, towards the media, the humidity is too low. Keeping cultures in plastic storage drawers, such as those made by Sterilite, is a quick and easy way to insure that proper humidity is maintained.
Did the culture have excelsior in it or something else? Does it look really wet?