If someone performs ghusul e janabat with wajib niyah and after ghusul realised that the namaz time wasnt reached yet. Is the ghusul valid and one just has to do wudhu for wajib salat or have to do ghusul again with sunnah niyat?

Yes It is valid