Circuit complexity? That circuit is already over-complicated.
So your gpio sets the internal weak pullup, M2 will be turned on all the time, which will also turn M1 on.
When S1 is shorted, M1 will keep turned on as long as the button is pressed, without any way to turn it off until it's released, which is a bit scary depending on what M1 is controlling.
After that, you read the gpio, if read low, you set the gpio as output, low level (or turn off the internal pullup), switching off M2, and opening M1 when S1 is released.
Now you'll never now when S1 is pushed again...?
Anyways, you can do the same thing much easier... Use a high gain npn bjt like BC547C, which is extremely common.
100K is the internal pullup, being the GPIO directly connected to the base.
There's a small difference: The switch instantly turns off the output.
If you want to keep M2 on while the switch is pressed, then add the diodes like in your circuit.