No matter how many janitors, cooks, etc you have you'll never invent a rocket. Most hard working people are just doing societal plumbing not inventing. So losing a bunch of them won't impact the technological advancement of your society.
But, I still think there's a flawed premise here. Loosing a janitor to UBI means that they can occasionally help their friend with rocketry or some other pursuit they have interest in. Providing UBI means that geologists don't need to hoard data because they won't starve if they don't get a cut from it's usage. The people involved in technological break through are often doing it for self-interest or fame and don't stop once they've hit some financial breakpoint.
We're long past the point where we barely need anybody to work to actually feed/house everybody and at this point it's all gravy. For obvious reasons we couldn't feed/house everybody if they wanted to solely live in NYC but IIUC no UBI proposal is about that; UBI lets you live in below median-desired places without additional income.