I’m no electrician but I’ll take a stab at an uneducated reply.
I believe every outlet, light switch, wire splice etc needs to be in an enclosed junction box. There are not conventional junction boxes in an rv, they use the weird combination outlet/junction box things you found.
If you changed...