Unlawful presence when RFE is in process
Officially, anyone who has filed for extension before i94 expiry can legally stay in US for up-to 240 days after i94 expiry to wait for extension result, including RFE days.
For H4 dependents, this 240 day is usually ignored and they can stay for as long as the extension process takes.
BUT, this is NOT documented anywhere by USCIS officially.
So, it is up-to an individual to stay beyond 240 days or not.
See this similar case where H4 dependent minor son’s extension was delayed:
https://www.truvisa.com/t/does-240-day-rule-apply-to-minors-h4-extension-too-i94-expired-and-uscis-decision-pending/221
Unlawful Presence after i94 expiry
In legal terms, yes, your stay in US after 240 days of i94 expiry AND if the extension decision is still pending, can be counted as ‘Unlawfully present’ in US.
With so many USCIS rules changing these days due to political pressure, i would strongly suggest to not take that risk of staying beyond 240 days at all.
In a perfect normal world, USCIS would not care about H4 dependent’s unlawful presence till the time H1B’s visa was valid.
But, it is not a normal world today.
H4 extension approved with i94 expiring in 3 days or small expiry
You cannot wait.
i94 expiry when none of your extension is PENDING (You said if H4 is approved by USCIS with very less time left), is definitely an ‘Unlawful presence’.
Don’t worry, most probably, USCIS will not create this scenario and they will issue an RFE to get details of your son’s new passport.
But, if it does happen, you will have to get i94 renewed ON or before it expires.
Does that answer your question?