I've been training magic a lot on RS 3 lately reaching level 22 while my normal attack and strength are at level 4 and ranged is even at level 1. Is this normal? or should I be training all of these skills to around the same level?
Leveling up your skills tied to combat will increase your overall combat level a detailed description on what this does and the benefits can be found here
But for the sake of ease I will highlight the important bits here
which skills and the formula used to calculate the combat level:
- Attack and Strength or Ranged or Magic
- Summoning (not applied toward combat level in free worlds)
The effect of your combat level:
Normally, aggressive NPC's will stop attacking a player if the player has double the NPC's combat level +1. There are exceptions, however - for example, some monsters in the Wilderness that are normally not aggressive will be aggressive to players no matter what their combat level is. Also, normally aggressive monsters that are level 69 or above will always attack a player, since the maximum combat level for players is 138.
So to answer your question, no it is not needed if you want to but it can be recommended as it does help you.
I would suggest to take a look at this OSRS Combat Calc. As this tool will help you to determine what level for which combat level you need. So using this tool you can easily plan ahead on which combat level to lvl up first.
I will preface this answer with the assumption that you have a "main" combat skill which is the one you like the most and which your combat level is based on. Defence, HP, Prayer, and Summoning help in various situations regardless of your preferred combat method and you definitely will want to train those (unless you are going for a pure account or want to have a low combat level for your main stats for PvP).
This depends on your goals when playing. If you are only interested in fighting things and getting loot or PvP, then your non-main combat skills do not matter very much. Melee can be useful when you run out of runes and ranged is good for certain enemy types and PvP strategies, but magic is already the most useful with teleport abilities, buffs, and enchantments. Regardless, you will rarely if ever be forced to use a combat type other than your preferred one if you pick your battles.
If you just want to max out your combat level, the formula provided in KevinTheGreat's answer shows that it only uses the maximum level of your magic OR ranged OR attack/strength. Therefore the other combat types don't matter whatsoever, though you will need to train Def, HP, Prayer, and Summoning.
If you want to explore all of the games quests, mini-games, and achievements however, you will need to have levels in every skill. Desert Treasure requires 50 magic, Temple of Ikov needs 40 ranged, and Legends Quest demands 50 strength, and these aren't even the highest level quests! A lot of this game is exploring the world and setting your own goals, so there's no there's no right answer to this question, but if you want to do and see everything, you gotta train every skill.