Are apps device dependent?
Not all apps are device dependent, but many are. One particular example is, indeed, the camera app, which is often dependent on OS revision, the actual hardware, and the framework the OEM is using (such as Touchwiz on a Samsung device). Many are reliant on the version of Android, although typically this only impacts using on an older version, up to a point.

As well, apps can be either developed separately or part of the system. Just depends on how the manufacturer wants to handle it. But they'll typically, these days, update them separately which then replaces the system app (really it just covers up the old version which remains), so the answer tends to be "a little of both." But if it's something made by the device manufacturer, they WILL lock it to their devices.

However your particular example, of the Gallery app from Jelly Bean, would probably at least partially function on a newer OS. That's based in AOSP, so not device-dependent. Only possible issue is whether it has any conflicts with newer apps on a newer OS.