You have found a real mess here. In my professional opinion a DISASTER waiting to happen!!!
If the first panel is the service panel, then those taps are service taps.
The lugs they are terminated in are not designed for that type of connection.
It makes the conductors heading toward the “subpanel” service conductors and they are not protected by any overcurrent device - very dangerous!!!
What kind of wiring method is this - cable, raceway, open conductors?
The subpanel is required to have 4 conductors installed. 2-phase conductor, 1-neutral conductor, and an equipment ground conductor. You could suggest they eliminate one phase conductor and have the conductor terminated to a single pole breaker in the service panel… that would make the “subpanel” a single phase panel, no 240Volts available.
The conductors are not properly identified. Neutrals and equipment grounds in the “subpanel” need to be isolated, separated.
Taking another look at the “subpanel” installation… the way it is wired, the circuit breakers will not trip due to any kind of GROUND FAULT, as there is no equipment ground conductor or bond for the fault current to follow back to the panel supplying the “subpanel”
Very, very bad installation… if I were you I would recommend a professionally licensed electrical contractor to fix this IMMEDIATELY!!!
This will most likely be a fairly expensive change