There is no reinvestment assumption in your calculation and in computing yield to maturity (YTM). All you have is 20 payments that you discount with the YTM.
In your case, you have 19 times a cashflow of 3, and a single cashflow of 103 at the end. These cashflows you discount with the computed YTM to get to the market value (or net present value / NPV) of the bond.
In Julia this could be computed like this (ignoring all details like day-count, leap years etc).
cf = append!([3 for i in 1:1:19],103)
df = append!([1/(1+0.035)^(i) for i in 1:1:19],1/1.035^20)
dcf = append!([3/(1+0.035)^(i) for i in 1:1:19],103/1.035^20)
df = DataFrame(cf=cf, df = df, dcf = dcf)
There is no need to follow the code logic. The dataframe below shows the result. The first column (cf) represents the undiscounted cashflows. The second, (df), are the discount factors, and the third, (dcf), stand for the discounted cashflows.

In this formula, there is nothing happening with all the coupon payments after they are received. Put differently, a 5% bond annual fixed rate bond simply pays a 5% coupon rate every year. If YTM is also 5% it is priced at par. Yet, if your bond has a maturity date in 5 years, you do not get 100*(1.05)^5 ~ 127,63 but simply 5*5+100 = 125 from the bond (see example below).
The confusion that many people have is that it is assumed that you get 127,63. However, this is not the case with a bond as you would have to compute the investment of every single coupon separately to get to this value. So for the first payment in your example, you would have 19 periods with compounding, which would yield an additional 3*(1+0.035)^19 ~ 5.77 in your example. Summing this for all 19 periods (the last coupon is only paid at the end), you add ~81.84 to your gain, and get a total of 184.84 as shown below with 100*(1.035)^20.

The example with 5% for 5 years looks as follows:


Long story short, the YTM has no reinvestment assumption and the NPV of the bond is computed without this reinvestment assumption because all it does is to discount the payments of the bond.