Can you apply for public school EA, if you apply for REA?

If you are applying for Restricted Early Action for universities, such as Stanford and Princeton, can you still apply non-binding early action to public universities, such as University of Virginia and University of Michigan?

Usually yes particularly if merit aid is only eligible to EA applicants. My D did that a few years ago with Stanford and UMich. You may want to look up the REA school website for the details.

Read the REA/SCEA school’s restrictions on its web site.

Stanford and Princeton do not restrict early non-binding applications to public schools, but this is not necessarily true for all REA/SCEA schools.
https://admission.stanford.edu/apply/decision_process/restrictive.html
https://admission.princeton.edu/how-apply/application-dates-deadlines/single-choice-early-action