Here's my suggestion, which I've sent to Apple (and which I encourage you all to do, as well -- if enough people send it, maybe Apple will listen!) :
The Dock is trying to do too much. It should just be for applications, with windows and documents being either handled by some other means, or...