2年ほど付き合って、パートナーのことを理解した上で結婚を考えたい。
I want to date for about two years and get to know my partner before I think about marriage.
I think I understand what you are having trouble with. The status of 付き合っている is terminated by 結婚. If the couple marries according to the plan, and 3 years have passed with them being in marriage, you CANNOT say: 私たちは5年間付き合っています。
Across many of its senses, 付き合う has a non-obliging nuance. As an honorific device, it hints at the listener being so gracious that they attended the speaker when there is no obligation to do so:
1ヶ月間お付き合いくださり、誠にありがとうございます。
[Said to listeners by a radio talk show host concluding his month-long programme.]
The non-obligatory, non-binding nuance can be felt in uses of the verb for romantic contexts. A viable description of the couple's history of their relationship is: 私たちは2年付き合って、結婚して3年です。
The verb cannot translates well the English expression "to be together" in this context.
At any rate, in the original (5年ほどの付き合いで), doesn't that で after a noun (nominal verb form) serve basically the same function as the -て form does after a verb?
Yes and no. You seem to have equated 先生とは5年ほどの付き合いで with 一週間の休みで、元気が戻った, but they aren't using the same grammatical construction. The former で is a conjugation of だ (I am not familiar with the term nominal verb form, but it seems right), but the latter で is a postposition of means, instrument, or a "converter" of measure words into means or resources to do something (sorry for a verbose explanation, I am really at a loss).