Please also be sure to use the equation for N_hat that we provide on the genomic sem wiki page that Andrew linked to. (Also, note that we refer to the predicted sample size based on the GWAS SEs as N_hat and not Effective N, which we reserve to refer to the expected sample size under an equally powered balanced case control design). I have not looked closely at the equation provided on Demange's github. It is possible that it is equivalent to the one that we provide, or may even be adapted for use with unit variance identified latent variables.
I should also say that we are relying on your evaluation that the computed N_hat is very low. What constitutes a plausible N_hat likely depends on the Ns of the contributing GWAS and the proportion of unexplained genetic variance in the downstream GWAS phenotype after controlling for the genetic component of the upstream GWAS phenotype. If the proportion is very low, we would likely expect the N_hat to be much smaller than the observed N.
It's hard to make a blanket recommendation for what to input into downstream analyses. That will likely depend on the software for the downstream analysis and what it uses. If the software only uses the Z and the N, then the betas input shouldn't matter at all as long as the beta to SE ratio is the same (which it should be), but the N input will matter. If the software uses betas that are expected to come from GWAS of standardized phenotypes, then you need to decide what scaling is most appropriate (e.g. unit loading vs. unit variance, and if using unit loading which GWAS phenotype to take on the metric of) and this decision is nontrivial. It may be that the N is used to compute the SE of the beta, so you need to choose the beta and N combination that would produce the correct Z statistic. Again, it's hard to provide blanket guidance, but you should be attentive to what the software is asking you to input and how it is using that information.
All the best,
Elliot