First journal: I am not sure what they claimed, but 4 months without communications seems a long time. They are at fault. But they can live with harming your interest, you are "just" a client, golden rule for a succesful business is "you cannot please all your clients".
Second journal: I assume they asked you (via submission forms and the like) if you submitted or if you were planning to submit the same material somewhere else (or similar legalish gibberish). Depending on what you answered, you are at fault. You have been careless and you harmed yourself doing your job, luckily your job is not "truck driver", so for the moment the damage is only on you [1].
However the first journal has a history of poor communication, ask insistently confirmation of the cancelled submission. Apart from the copyright, there is the larger issue of people already doing peer review (free work) without any use.
Additionally, if your research field, or at least the pool of experts regarding your paper topic, is small enough, you put yourself in a dangerous situation: what if the two journals sent your paper to the same reviewer? If I were the reviewer (let's say I am reviewer A), I would immediately contact the editors that sent me the paper for review.
In a theoretical world, the second submission may be invalid (we do not know what you declared during submission), so you should withdraw the second submission and submit it again to another journal, openly declaring to the editor all the submission history with the previous two journals, so the editor can properly present your paper to the reviewers.
Reviewer A receives then the same paper for the third time. Thanks to the short introduction from the editor, reviewer A finally understands the authors had issues with submission to the previous journal(s).
Without the note from the editor, reviewer A would think the authors are exploiting peer reviews and the submissions system, trying their luck to get their work published in blatant disrespect of decency, fairness and consideration for other people works.
[1] Don't worry, Academia (the big one, not StackExchange only) is full of people taking moral shortcuts and having all kind of double standards, so you are not the first, nor the last, but at least consider how serious it is if you lied, even if it was just a "box ticking form on the web".