Well, PHP is a Turing-complete programming language, so of course one can implemente anything in it. But, to implement some things, you would basically have to start again from the beginning.
My main reason for saying it is practically impossible to implement the feature you want within the Moodle quiz activity comes from thinking about the data model that underpins the quiz. The Quiz database structure docs page is woefully out-of-date, but actually while details have changed, the latest schema is logically the same.
The way the current schema is organised (the key point is that maxmark is a column in the quiz_slots table) has implications throught the quiz codes (e.g. all the grading calculations, all the reports and statistics). It is not feasible to change it.
If you really need the kind of activity you describe, it would be best to create a new type of activity https://docs.moodle.org/dev/Using_the_question_engine_from_module