The thickness of the MacBook Pro's lid does NOT limit the RESOLUTION of the sensor. It limits the SIZE of the sensor with a given set of optics.
If they wanted to, Apple could've put in a 12MP / 4k sensor, but at that size you're talking about incredibly tiny pixels with horribly compromised dynamic range and signal-to-noise ratios.
Given identical sensor technology, that hypothetical 4k webcam (and indeed a 1080p one) would look better than the 720p one in a highly optimised environment with carefully set studio lights (assuming the lens is able to resolve that amount of detail) - but the 720p one would be better in almost every other scenario.
In the end, I bet that Apple did try several webcam modules, including 1080p ones, and figured that the 720p one had the best balance of power consumption, dynamic range, noise, colour and cost, while delivering resolution that's good enough for the majority of users.
There is probably a 1080p module out there with superior sensor tech that could've produced better quality across the board, but Apple probably didn't think it was worth the cost and power consumption.
Having said that, I do think that the 720p webcam on this MBP is good enough for anyone who's not streaming professionally - it's excellent for Zoom meetings, and anything better would not be noticeable.