You're allowed connections of up to 24 hours on int'l itineraries.
There are frequent enough flights SFO-EWR that you may be able to make this work for you if just under 24 hours will do it for you in SFO.
Once you get to SFO, you may be able to SDC to an even later SFO-EWR for the SDC fee which is relatively minor compared to a change fee + refare.
All of this would be above board.