Default factory resetting iPhone 4
Is it possible to reset an old iPhone but keep the operating system with all updates?


Yes, and that's the default behavior when resetting an iPhone (or any iOS/iPadOS device).

When you reset an iPhone to its factory settings, the OS updates installed are retained. Or to put it in a simpler manner, when factory resetting an iPhone (or an iOS device), it is not reset to the version of OS with which it shipped, but the latest installed version of OS is retained.

On the other hand, with the Apple's signing process, it's technically not possible to roll back to older supported version(s) of iOS after update (and after Apple stops signing the older version(s)).

For an iPhone 4, iOS 7.1.2, is the current latest support version, and you have it installed, you can't go past it to an older supported version (iPhone 4 originally shipped with iOS 4.0).