The syntactical behavior of anaphoric so (so employed as a pro-form, pointing to some other syntactical entity) is one of the quirks of English that delight linguists and reduce learners to tears.
OED 1, s.v. So (sōu) adv. and conj., carefully avoids classifying the word as a pronoun:
I. 1. In the way or manner described, indicated, or suggested; in that style or fashion.
[...]
2. With the verbs do, say, think, etc., latterly assuming the function of an object and passing into the sense of ‘that’.
(That ‘latterly’ is weaselly: OED’s earliest citation of so in usage 2. is ca. 825!)
There is no conclusive answer to this question. You may paraphrase do1 so2 either as “perform1 [the previously named action]2” or as “act1 [in the previously named manner]2”. Which analysis you adopt depends on what you want to do with your analysis. I would not like to have to diagram this sentence.
The question was discussed at length on ELU, here. Note particularly the accepted Answer, which starts:
The Cambridge Grammar of the English Language has three pages on anaphoric so. It concludes:
...its properties are unquestionably unique, and we do not believe that anything is gained by forcing it into one or more of our general part-of-speech categories.
I would dearly love to read the paper mentioned in John Lawler's comment there, Lakoff and Ross, “Why you can’t do it into the sink” (in James D. McCawley (ed) 1976. Notes from the Linguistic Underground, Syntax and Semantics, V.7, pp 101-111), but my library does not have it. It might answer your question more satisfactorily; or it might introduce even more entertaining perplexities.