No, they shouldn't be mandatory. Choosing to attend or not attend the lectures is part of adult student life. Nobody is there to spoon feed you and you are responsible for your own time management and staying well organised and that's the point. University is not secondary school where you are told what to do. At university, you are encouraged to manage your own time and you are free to do what you want. You have to learn how to meet deadlines and just how to be an adult. One part about being an adult is to take your life into your own hands.
Also, I am not sure if at your university you get to watch recorded lectures or not, but when I studied at university during COVID the lecturers would pre-record their lectures so that students could watch the lectures in their own time. I imagine quite a few universities have now adapted this approach. So because of that, now there is even less need for students to attend lectures because why would you attend lectures live if you can just watch the pre-recorded lectures in your own time and get the same result? If you have any questions to ask then you can just email the lecturer. Finally, the end result as you have mentioned yourself is to get a 2:1. If you can achieve that without attending all the lectures then that's good. You have come up with a good learning strategy to get the grade you need and maybe you have decided that attending all the lectures is unnecessary anyway.