I am aware that I could set budget alerts so that I get notifications regarding the limit. But can I set a hard limit on the budget that I spend on the google cloud platform?
It is possible to cap costs and stop usage for a Google Cloud project. You need to
setup up a budget to monitor project costs,
enable budget notifications
and then configure a Cloud Function to call the Cloud Billing API that disables billing for the project as described in GCP documentation.