Does self-sustaining automation (if achieved) fit Marx's labour based theory of value?

by NEED_MORE_CAPITALISM

If humans hypothetically (in the distant future) manage to create automated machines that could (eventually) extract resources, build, and maintain themselves. Powered by AI. How would this affect Marx's labour based theory of value? Who would* 'own' the produced value of the machines?

Side question: To what extent is an intellectual process considered labour? If someone spends years developing a mathematical equation that improves the efficiency of labourers in a given field, to what extent is that person responsible for the increased value? Does any of the research count as labor? All of it?

Sorry if these are frequently asked questions guys. I tried to research this myself and a lot of answers are conflicting or address points that orbit my question, but without any concrete answer.

Thanks again guys!

*EDIT (for Clarification): I mean who would 'rightfully' own the value. I am assuming that Marx believe labourers are entitled to the value of their production. If I am misinformed please correct me.

MonsieurMeursault

You may ask /r/communism101.