Of course dev teams know if the game there making is poor. But the developer's arn't in charge in most cases. The publisher will have a deadline that they want the game released by and any delays add more cost onto the title.

Something else you might not realise is that every game released on a console has to be submitted to Nintendo, Sony, Microsoft, depending on the platform its designed for, for certification. All games have a set date they have to be submitted by. If the publisher misses thier slot it may be months before they can resubmit it. There's also only a few places that press game disc's, which again the title will have a set date to be pressed and if thats missed it causes another delay.

All of this cost's money, which most companys don't like to spend anymore than they have to. So if they know they've got a turky instead of paying more money to make it better it's just thrown out as is.