The latter application claims the priority of the earlier application.
If the claims claimed in the later application are disclosed in the earlier application, the priority can be claimed.
If the claims claimed in the later application are improved on the basis of the earlier application, as you said, it will add something new. You can't claim priority. Rewriting is even worse.
Of course, in the actual examination process, examiners generally don't conduct in-depth examination, and it's too late to see the same theme. However, in the process of invalidation, the invalid claimant comes back for analysis, which will lead to the failure to claim priority, and then lead to the postponement of the patentability judgment time.