The Messenger of Allah ﷺ (at times) got up in the morning in a state of junub, not because of sexual dreams (but on account of intercourse at night), and then observed fast.
أَنَّهُ سَأَلَ أُمَّ سَلَمَةَ ؓ عَنِ الرَّجُلِ يُصْبِحُ جُنُبًا أَيَصُومُ قَالَتْ كَانَ رَسُولُ اللَّهِ ﷺ يُصْبِحُ جُنُبًا مِنْ غَيْرِ احْتِلاَمٍ ثُمَّ يَصُومُ