Grammar Question: SVO, doing

The students found fieldwork in the state forest more exciting and dangerous than any of them had “anticipated, having to” be rescued by helicopter during a fire.

A. anticipated, having to be
B. anticipated; when they had to be
C. anticipated: they had to be
D. anticipated: among which was their
E. anticipated, and so they had been

The correct answer is C.
I read online that A is considered incorrect because the phrase “having to be rescued” has no noun or pronoun to modify. I thought that the phrase was correctly referring to the students??

Also this question:

To attract prey, a fish known as the red grouper restructures the ocean floor, “digging holes to create” the type of environment favored by smaller fish and spiny lobsters.

A. digging holes to create
B. digging holes creates
C. digging holes create
D. it digs holes creating
E. they dig holes to create

The correct answer is A.

How come the “digging holes to create” is now correctly referring to the fish instead of the ocean floor??

So my final question is really this -
Whenever the sentence structure is “SVO, doing something” does the doing refer to the subject or object?

Thanks so much and sorry for this long post LOL