The obvious explanation would appear to be that the Jobe server is overloaded. Do you have some reason to believe that that isn't the case?
A test with 400 students i getting into the danger zone where overloads of various sorts are possible, depending on both peak and averate rates of submission, language (Java and C++ are both bad), number of test cases, use of a combinator or not, compute time per question, frequency of timeouts (endless loops in student code), ...
Having attachments adds to the load on Jobe. Jobe maintains a file cache that maps from a file ID (the MD5 hash of its contents) to the actual file. Files are uploaded to the cache by HTTP PUT requests, and jobs are run with HTTP POST requests. To avoid unnecessary repeated file uploads, CodeRunner first tries to run a job (a POST) with just the required file-ids in the job specification. If the request fails with a 404 (because Jobe finds it does not have all the files it needs to run the job), CodeRunner then PUTs all the files and retries the POST. This strategy is a huge win with author supplied files, which only ever get uploaded once. It's also a win if students reuse the same file or if there are multiple test cases in the question and all run separately (i.e. no combinator or it's a "write a program" question type), using the same file(s). However, in a worst case scenario (a student provides just a single small file, never resubmits or retries the question, and the question runs all tests in a single run) it results in 3 round-trips to the Jobe server. This might push your Jobe server into overload if it's close to it on questions without attachments.
With tests of this size I recommend multiple Jobe servers - did you realise that in the CodeRunner settings you can list multiple Jobe servers separated by a semicolon? One gets chosen at random for each run.
I agree it's a bit surprising that you're not seeing the same issues with Moodle 4.3 and the same Jobe server. The protocol is unchanged. Were the class sizes in the two scenarios the same? One possible explanation could be that Moodle 4.3 is a bit slower, so can't throw jobs and Jobe quite as fast.