You can modify the last line of your first code snippet to:
model = tf.keras.Model(inputs=x, outputs=[output, a, b])
This will allow you to access the intermediate tensors when calling the forward pass.
Internally this will not call your layers multiple times.
Please let me know if this was your intended point.