This thought is as a death which cannot choose
But weep to have that which it fears to lose.
What is this to after weep? Is it like "I am sad to hear your father's death?"
You have parsed this correctly. An infinitive clause subordinated to a clause expressing a strong emotion usually expresses the cause of the emotion:
This is also true when the head clause expresses an emotional reaction rather than a state:
This language is both poetic and archaic. So you get a double dose of unusual and complicated syntax.
First off, I expect there's an enjambment happening in that line. Treat it as one sentence:
The thought (and by association, the speaker--"which" is much less specific in poetic usage) "cannot choose but weep"--that is, he can't help but cry--at having something precious that will inevitably be lost.
The infinitive introduces the circumstance which causes the speaker to feel that way. He has something he fears to lose, so he can't help but cry. This is the same construction as "I was happy to see you" or "I couldn't help but smile to think of him running playfully through the field." The infinitive is there to introduce the cause or circumstance of the earlier emotional response.
For convenience, I have interpreted the passage with the speaker as the subject.
This thought makes me feel like dying,
To "weep to (do something)" can mean to feel that one must (do something), because if they do not, then it would cause sadness or some sense of loss. It's like saying that you would "rather die than give something up".