You can replace an expired passport by mail using only your expired passport (FWIW, my wife and I recently did just that). There are also a variety of alternatives to a state ID that can be used.
Social Security Card
The are alternatives to a state ID or driver's license if you seek a replacement Social Security card in person and explain that you do not have a state ID (the list of permissible documents shown at the link is not exhaustive; a birth certificate and a relative to verify your identity is permitted at an in person office; I did that once for one of my children who did not yet have a state ID or a passport).
New Jersey also has dozens of different documents that can satisfy its identity requirements, and five different kinds of documents that can establish your Social Security number (a requirement that is likely to be dispensed with soon). In particular, a passport that is expired for less than three years can be used to obtain a state ID in New Jersey.
The need for a Social Security card at the DMV is being phased out even faster than it was imposed in the first place (although New Jersey has not yet updated its process):
For evidence for Department of Motor Vehicles/Driver’s License (REAL
ID): Federal law (REAL ID) no longer requires states to see proof of
your Social Security number (SSN), though some states may still choose
to require proof. To learn about the REAL ID requirements in your
state, check with your Department of Motor Vehicles or appropriate
Instead, most states recently switched or in the process of switching to simply contacting the Social Security Administration in an electronic query to confirm that your Social Security number is valid.
Also, in many states (some just starting to allow this post-COVID), a new state ID or driver's license that is lost can be reissued using the information already on file or your current or recently expired state ID. Colorado, for example, has a fingerprint, photo, and other identifying information on file electronically (as well as a record that you have a Social Security number previously established in your last application).