I've made an engine for this kind of thing, if you're more interested in getting a result quickly over learning:
https://yaru.itch.io/soulsvania-engine
Functionally, a metroidvania is just a platformer where you can move between levels in more than one direction. Once you figure out how to code doors that can take you to any position in any room, it's pretty easy (maybe also coding "flags" so you can only collect powerups and upgrades once, plus some global/persistent data system to store your abilities and plot progress) and the rest is
design questions - e.g. you need to make sure to design levels so the player can't get permanently stuck if they go into an area without a necessary ability (solved by having a mandatory "you need this ability to proceed" gate at the entrance), make all rooms traversible in both directions (not 100% necessary if you've got alternate paths and loops but generally a good idea), and make sure that the player can FIND the path forwards.