Understanding SD card image vs. kernel compatibility

If you want to build a custom kernel to be used with an SD card image of FreeBSD, you have to pick a kernel source git version which works with that image.

If you pick a wrong version you end up with something like "module 'kernel' exists but with wrong version" message and booting stops right at the start.

A secure bet may be to pick a RELEASE version kernel sources for an image based on the same RELEASE version.

But if we have a recent enough version of kernel for which there's no RELEASE version image yet available, it gets more difficult. From my experience, the failure is more than likely.

I'd like to understand this SD image–kernel compatibility issue better. Any pointers?
Source branches translate to various versions:
  • releng/X.Y -> X.Y-RELEASE (includes any patches, i.e. -p1, -p2, etc)
    Example: releng/13.2 is 13.2-RELEASE
  • stable/X -> X-STABLE
    Example: stable/13 is 13.2-STABLE
  • main -> Z-CURRENT
    Example: main is (at this time) 15.0-CURRENT