Re the original question, an earlier development of tropical medicine might have boosted population growth before the demographic transition. As to whether they could feed themselves, I dunno: if Cuba had Haiti's population density it would have over 37 million, but then Haiti is notoriously advanced in the process of destroying it's topsoil through overcultivation - but on the next tentacle, Haiti's agricultural productivity per acre farmed is probably less than more advanced nations.
Most of Cuba's very poorly suited for that level of urbanization, or super-intense farming like you see in parts of the US. It's hilariously rugged over large parts of the island, So you'd see Havana and Santiago de Cuba with densities comparable to Tokyo or Hong Kong before you got close to hitting 30 million people.
I could honestly see somewhere in the low twenties, if Tropical disease were tackled early enough for American Expats to seriously consider it a major option, and it could avoid the violence and economic troubles that came with the Ten Years' War, Little War, and Cuban War of Independence IOTL. Even then, under those positively ideal circumstances, thirty million people is asking for a bit much.