TL;DR: There is no risk in buying older generation Canon body.
Canon is known for the consistency of lens mounts and compatibility. They have 3 mounts for photography right now, 2+1 actually.
- Oldest EF mount for fullframe.
- Younger EF-S mount for crops.
- Youngest EF-M mount for mirrorless.
EF lenses can be used on EF-S bodies directly, not vice versa! Other combinations are possible with proper adapters.
Both your bodies use EF-S mounts so there is no risk at all by using the older body. If I read the Canon designations right, the second one should be higher tier body (when same generations are compared) which compensates the differences in running-in and running-out bodies (when same tier is compared).
In other words, new EOS 1xxxD should be slightly better than EOS 4xxxD. It is possible, that the 4000D is slighty modified 1300D design, therefore the same specs.