Boring Answer: We don't know until Infinity War II Comes out
Presumably included in the futures Dr. Strange saw is the one where he tells Quill about Gamora ahead of time. Maybe your question (and the countless of similar ones we are all coming up with) will be addressed in the movie, but there's probably no way to account for all of them.
Of course, since Dr. Strange told Tony as he was disappearing that This was the only way, we have to presume that the one unique winning future hadn't been ruled out by that moment, meaning Quill's actions didn't damn the universe.
Part of the fun of addressing alleged plot holes in movies is coming up with counter-examples for them, right? So let's have fun and throw some options out:
1. Quill wouldn't have been able to contain himself during the fight
Maybe Dr. Strange saw every possible future where an attempt was made to get an informed Quill to contain his emotions, but in each scenario the fight was lost.
2. Thanos couldn't have been defeated without Quill
Dr. Strange couldn't just take out Quill (e.g., infinite falling a la Loki in Ragnarok) ahead of time because the tide of the battle would have turned to Thanos' favor without Quill's contributions.
3. Maybe Thanos needed to almost lose the gauntlet in order for future events to transpire
Thanos was within about a second of losing everything he had worked for. Maybe in that moment, as happens cinematically with a near-death experience, his life choices had been flashed in front of him. Maybe the recollection of that will influence his choices in the next film.
4. Maybe defeating Thanos on the spot would have been certain doom in other ways
I know it's perverse to think of our Avengers this way, but maybe Dr. Strange saw the futures where the gauntlet does come off and land on the ground in all sorts of ways. Subsequently, mere sight and reach of unimaginable power corrupts one, or several, or all of the present Avengers (looking at the rabbit in particular, here). Maybe one of them grabs it and does terrible things. Or maybe none of them do and the gems get put in some "safe place" that is eventually raided and a worse outcome than the Thanos one happens. I mean, really, in the MCU where are you going to safely stash the gauntlet that someone won't come looking for it?
Or something else? We will be in a better place to answer questions about Dr. Strange's decision after the next (and hopefully last) Infinity War movie comes out. Until then, hopefully the above suggestions are enough to ease your mind that there are possibilities that the writers didn't just botch this whole thing.