This is tricky indeed. Until you officially withdraw the manuscript or the journal communicates a decision of rejection, your manuscript will be considered to be submitted to the journal. Thus, technically, your manuscript is still officially submitted to Journal B. It would therefore be considered unethical to try submitting to Journal A again while Journal B is awaiting your revised manuscript.
The manuscript would not be accepted in Journal B until you submit a revised version, and there are no risks of the manuscript being accepted in two journals. If you feel that Journal A would be better suited for your manuscript, you should first withdraw your manuscript from Journal B before submitting it to Journal A.