Why do Organolithium or Grignard reagents act as nucleophiles and not as bases with aldehydes and ketones
In fact, both reagents you noted here have quite complex structure and are not nucleophiles at all: both are electrophiles, because metallic atom here has too little neighbors to draw electrons from.

Let me explain, using Grignard reagent $\ce{EtMgCl}$ . In reality it has complex structure with $\ce{Mg}$ atom coordinated to alkyl fragment and two diethyl ether molecules. When reacts, it coordinates first with most nucleophilic atom. In case of alcohol it is oxygen of $\ce{OH}$ fragment, and of course it  reacts with closest easily migrating atom: hydrogen, producing alkane. In case of ketone it coordinates with $\ce{CO}$ group, and alkyl group attacks closest electrophile : carbon from $\ce{CO}$ group, whose electrophility was just boosted.

If right compound, effectively bounding to metal atom, is added and no other way of reactions is readily available, both reagents can work as bases. For example, organolithium compounds can replace hydrogen atoms in alkynes, alkenes and arenes as you noted earlier.