I’m not trying to be pedantic, but when it comes to electrical safety, liberal interpretations can lead to bad outcomes.
A junction box is not a sub-panel. A sub-panel, with breakers for the incoming circuit as well as one each for the 14-50 outlet and the 5-20 outlet, would be ideal in this case.
What was described is a junction box with an incoming wire feeding both outlets all connected to the same breaker in the panel. It’s that junction that can be dangerous. How is the 12 gauge wire for the 120v outlet joined to the 6 gauge wire for the 240v? Were both conductors jammed in the 14-50 outlet terminals? Could that cause a weaker or looser connection leading to heating up of the outlet? Probably not, but there is a chance.