No, I think you must estimate p only using the cohort where people were not treated, otherwise you will underestimate the population fraction. In order to test if the null hypothesis is true, we can't assume that's its true when constructing the test.