Both lol. It might be more accurate to say Ricardo and Marx. Could Communism have existed if it wasn't for Ricardo?
I'd say there's a kernel of truth in what you said. Marx inherited and modified a classical economics framework associated with Adam Smith and especially David Ricardo, particularly regarding the labor theory of value. Ricardo's version did heavily tie the exchange value of goods to embodied labor, and Marx developed that into socially necessary labor time, surplus value, exploitation, and eventually, a broader indictment of "capitalism" itself.
In a way, it's a cautionary tale. Don't publish bad theory, because some dipshit can come along, inherit it, push it further than you intended or foresaw, and then treat the resulting nonsense as a revelation about reality rather than as defects in your premises.
Regarding the other question, I'd say it could absolutely exist without Ricardo because Marx also drew from (terrible) German philosophy, French socialism, Hegelian dialectics, Ludwig Feuerbach, class politics, revolutionary movements, and earlier socialist thought. But it's safe to say that the specific economic architecture would have been very different without Ricardo.
Ricardo gave Marx much of the economic scaffolding with labor-value reasoning, distribution conflict, rent/profit/wages analysis, and the idea that capitalism could be described through impersonal economic or historical laws. Marx then took these things and drove them in a far more radical direction