IIRC, in construction the requirement is that the bolt be at (or past) flush with the end of the nut.
The ASME reference in MrBlaine's snip is the nut spec which standardizes the depth/thickness of the referenced nuts. But that is dependent on the nut material since the goal is the fastener fails before the nut fails, so thickness could be different on a weldnut.
I'd say the safest route would be to match or beat the grade of the fastener, and purchase one at least the additional length of the material that was added. If the original fastener is flanged, and a hex head is used instead, addition of the washer should also be added to minimum length.
The 30 lb-ft is maxing a dry-set 3/8-16, so I'd expect to go grade 8:
View attachment 649344