You cannot jump from 2012 R2 to 2022. That isn't a supported upgrade path. However you can upgrade 2012 R2 to 2019. Then you can upgrade 2019 to 2022. Refer to a more detailed upgrade chart here.
- Refer to the official documentation here for in place upgrades along with the steps involved.
- To use Server 2022 you'll need licenses for every server. You should work with your MS partner or whoever you use for licensing but in general each server needs its own license. Since you have to stop at 2019 first then you'll need to get 2022 licenses but in general 2022 licenses will work with older servers. I haven't tested this against 2019 and 2022 specifically but it always has. Of course if you're just updating to 2019 to then jump t0 2022 you might get away with not having any activated licenses temporarily, again never tried it.
- I cannot answer this but in general AD cannot be updated to use newer features if you have legacy systems so I'd probably upgrade the domain members first and then update AD last so you can switch to any newer AD features that require updated servers. DNS probably doesn't matter here but I'm not an expert.
A strong word of warning though. I personally do not recommend you ever do an inplace upgrade of any OS. The issue with inplace upgrades are many fold. Firstly, if you are doing an inplace upgrade and something goes wrong your server is down until you either restore it or get the problem worked out. Besides that the server is going to be offline while the upgrade itself takes place and if you find anything wrong after the upgrade then reverting back is going to require a server restore.
The second, and to me bigger, issue is that upgrades do not, in general, make breaking changes related to security and disk structures. Security has changed a lot over the years and what was allowed 10 years ago isn't necessarily allowed now. As an example, 10 years ago an Admin may have been able to write to an OS directory. Today that is generally not allowed. All this is controlled by file and registry permissions. Upgrades rarely make these changes as they could break software already running on the system. So an inplace upgrade is a hodgepodge of new features with potentially old OS settings in place. Diagnosing problems with this can be difficult and when you ask the community for help some assumptions are generally made that may not be true on an inplace upgrade. To ensure the best security options are set up avoid inplace upgrades.
The third issue is that software that was installed before the upgrade may have been "version aware" and updating the OS to a newer version would not necessarily reset the software. So you may have software thinking it is running on 2012 R2 even though it no longer is.
The fourth issue is that 2012 R2 ran on different hardware than is available now. This is generally a great time to upgrade the hardware as well. Of course for a VM that might not be an issue.
The biggest advantage of inplace upgrades are: cost saving on hardware and not having to reconfigure existing software (either installed or used by). Since you mentioned using VMs the hardware savings aren't relevant. Starting up another couple of VMs (I assume you'll do this piecemeal) with new copies of Server 2022, migrating the software over and then turning off the old servers isn't going to be that costly.
The custom software running on the old machine is a bigger deal. If you just need to reinstall software then that isn't a problem but some software may be tied to the hardware that runs it so getting new licenses, getting all the configurations correct, etc can be time consuming. But on the flip side if something goes wrong your original server is still available so you're not going to be down. Of course if other systems are relying on software on the server (e.g. services, web apps) then switching servers can be disruptive unless you're using generic DNS names.
So, in summary, you need to upgrade from 2012 R2 to 2019 and then to 2022 if you want an inplace upgrade. You'll need new licenses for all the servers irrelevant. I would strongly recommend you consider doing fresh installs if that is at all possible. The only servers I might do an inplace upgrade on is the AD and/or DNS servers but even then...